6b3da4825b61f456fa243a2ed5c5febd5fb9e977
1 /* Definitions of target machine for GNU compiler.
2 For ARM with ELF obj format.
3 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
4 Free Software Foundation, Inc.
5 Contributed by Philip Blundell <philb@gnu.org> and
6 Catherine Moore <clm@cygnus.com>
8 This file is part of GNU CC.
10 GNU CC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 GNU CC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GNU CC; see the file COPYING. If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
25 #ifndef OBJECT_FORMAT_ELF
26 #error elf.h included before elfos.h
29 #ifndef LOCAL_LABEL_PREFIX
30 #define LOCAL_LABEL_PREFIX "."
33 #ifndef SUBTARGET_CPP_SPEC
34 #define SUBTARGET_CPP_SPEC "-D__ELF__"
37 #ifndef SUBTARGET_EXTRA_SPECS
38 #define SUBTARGET_EXTRA_SPECS \
39 { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC },
42 #ifndef SUBTARGET_EXTRA_ASM_SPEC
43 #define SUBTARGET_EXTRA_ASM_SPEC ""
50 %{march=*:-march=%*} \
51 %{mapcs-*:-mapcs-%*} \
52 %{mapcs-float:-mfloat} \
53 %{msoft-float:-mno-fpu} \
54 %{mthumb-interwork:-mthumb-interwork} \
55 %(subtarget_extra_asm_spec)"
58 /* The ARM uses @ are a comment character so we need to redefine
60 #undef TYPE_OPERAND_FMT
61 #define TYPE_OPERAND_FMT "%s"
63 /* We might need a ARM specific header to function declarations. */
64 #undef ASM_DECLARE_FUNCTION_NAME
65 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
68 ARM_DECLARE_FUNCTION_NAME (FILE, NAME, DECL); \
69 ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \
70 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
71 ASM_OUTPUT_LABEL(FILE, NAME); \
75 /* We might need an ARM specific trailer for function declarations. */
76 #undef ASM_DECLARE_FUNCTION_SIZE
77 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
80 ARM_DECLARE_FUNCTION_SIZE (FILE, FNAME, DECL); \
81 if (!flag_inhibit_size_directive) \
86 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
87 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
88 ASM_OUTPUT_MEASURED_SIZE (FILE, (FNAME), label); \
93 /* Define this macro if jump tables (for `tablejump' insns) should be
94 output in the text section, along with the assembler instructions.
95 Otherwise, the readonly data section is used. */
96 /* We put ARM jump tables in the text section, because it makes the code
97 more efficient, but for Thumb it's better to put them out of band. */
98 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ARM)
101 #define LINK_SPEC "%{mbig-endian:-EB} -X"
104 /* Run-time Target Specification. */
105 #ifndef TARGET_VERSION
106 #define TARGET_VERSION fputs (" (ARM/elf)", stderr)
109 #ifndef TARGET_DEFAULT
110 #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME)
113 #ifndef MULTILIB_DEFAULTS
114 #define MULTILIB_DEFAULTS \
115 { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
119 /* This outputs a lot of .req's to define alias for various registers.
120 Let's try to avoid this. */
121 #ifndef ASM_FILE_START
122 #define ASM_FILE_START(STREAM) \
125 fprintf (STREAM, "%s Generated by gcc %s for ARM/elf\n", \
126 ASM_COMMENT_START, version_string); \
127 output_file_directive (STREAM, main_input_filename); \
128 fprintf (STREAM, ASM_APP_OFF); \
133 /* Output an internal label definition. */
134 #undef ASM_OUTPUT_INTERNAL_LABEL
135 #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \
138 char * s = (char *) alloca (40 + strlen (PREFIX)); \
139 extern int arm_target_label, arm_ccfsm_state; \
140 extern rtx arm_target_insn; \
142 if (arm_ccfsm_state == 3 && arm_target_label == (NUM) \
143 && !strcmp (PREFIX, "L")) \
145 arm_ccfsm_state = 0; \
146 arm_target_insn = NULL; \
148 ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM)); \
149 ASM_OUTPUT_LABEL (STREAM, s); \
153 #undef TARGET_ASM_NAMED_SECTION
154 #define TARGET_ASM_NAMED_SECTION arm_elf_asm_named_section
156 #undef ASM_OUTPUT_ALIGNED_COMMON
157 #define ASM_OUTPUT_ALIGNED_COMMON(STREAM, NAME, SIZE, ALIGN) \
160 fprintf (STREAM, "\t.comm\t"); \
161 assemble_name (STREAM, NAME); \
162 fprintf (STREAM, ", %d, %d\n", SIZE, ALIGN); \
166 /* For PIC code we need to explicitly specify (PLT) and (GOT) relocs. */
167 #define NEED_PLT_RELOC flag_pic
168 #define NEED_GOT_RELOC flag_pic
170 /* The ELF assembler handles GOT addressing differently to NetBSD. */
173 /* Biggest alignment supported by the object file format of this
174 machine. Use this macro to limit the alignment which can be
175 specified using the `__attribute__ ((aligned (N)))' construct. If
176 not defined, the default value is `BIGGEST_ALIGNMENT'. */
177 #define MAX_OFILE_ALIGNMENT (32768 * 8)
179 /* Align output to a power of two. Note ".align 0" is redundant,
180 and also GAS will treat it as ".align 2" which we do not want. */
181 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
185 fprintf (STREAM, "\t.align\t%d\n", POWER); \
189 #define SUPPORTS_INIT_PRIORITY 1