arm-wince-pe.h (ASM_SPEC): Pass -mcpu and -march switches straight on to the assemble...
[gcc.git] / gcc / config / arm / elf.h
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>
7
8 This file is part of GNU CC.
9
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)
13 any later version.
14
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.
19
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. */
24
25 #ifndef OBJECT_FORMAT_ELF
26 #error elf.h included before elfos.h
27 #endif
28
29 #ifndef LOCAL_LABEL_PREFIX
30 #define LOCAL_LABEL_PREFIX "."
31 #endif
32
33 #ifndef SUBTARGET_CPP_SPEC
34 #define SUBTARGET_CPP_SPEC "-D__ELF__"
35 #endif
36
37 #ifndef SUBTARGET_EXTRA_SPECS
38 #define SUBTARGET_EXTRA_SPECS \
39 { "subtarget_extra_asm_spec", SUBTARGET_EXTRA_ASM_SPEC },
40 #endif
41
42 #ifndef SUBTARGET_EXTRA_ASM_SPEC
43 #define SUBTARGET_EXTRA_ASM_SPEC ""
44 #endif
45
46 #ifndef ASM_SPEC
47 #define ASM_SPEC "\
48 %{mbig-endian:-EB} \
49 %{mcpu=*:-mcpu=%*} \
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)"
56 #endif
57
58 /* The ARM uses @ are a comment character so we need to redefine
59 TYPE_OPERAND_FMT. */
60 #undef TYPE_OPERAND_FMT
61 #define TYPE_OPERAND_FMT "%s"
62
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) \
66 do \
67 { \
68 ARM_DECLARE_FUNCTION_NAME (FILE, NAME, DECL); \
69 fprintf (FILE, "%s", TYPE_ASM_OP); \
70 assemble_name (FILE, NAME); \
71 putc (',', FILE); \
72 fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
73 putc ('\n', FILE); \
74 ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
75 ASM_OUTPUT_LABEL(FILE, NAME); \
76 } \
77 while (0)
78
79 /* We might need an ARM specific trailer for function declarations. */
80 #undef ASM_DECLARE_FUNCTION_SIZE
81 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
82 do \
83 { \
84 ARM_DECLARE_FUNCTION_SIZE (FILE, FNAME, DECL); \
85 if (!flag_inhibit_size_directive) \
86 { \
87 char label[256]; \
88 static int labelno; \
89 labelno ++; \
90 ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \
91 ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \
92 fprintf (FILE, "%s", SIZE_ASM_OP); \
93 assemble_name (FILE, (FNAME)); \
94 fprintf (FILE, ","); \
95 assemble_name (FILE, label); \
96 fprintf (FILE, "-"); \
97 assemble_name (FILE, (FNAME)); \
98 putc ('\n', FILE); \
99 } \
100 } \
101 while (0)
102
103 /* Define this macro if jump tables (for `tablejump' insns) should be
104 output in the text section, along with the assembler instructions.
105 Otherwise, the readonly data section is used. */
106 /* We put ARM jump tables in the text section, because it makes the code
107 more efficient, but for Thumb it's better to put them out of band. */
108 #define JUMP_TABLES_IN_TEXT_SECTION (TARGET_ARM)
109
110 #ifndef LINK_SPEC
111 #define LINK_SPEC "%{mbig-endian:-EB} -X"
112 #endif
113
114 /* Run-time Target Specification. */
115 #ifndef TARGET_VERSION
116 #define TARGET_VERSION fputs (" (ARM/elf)", stderr)
117 #endif
118
119 #ifndef TARGET_DEFAULT
120 #define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME)
121 #endif
122
123 #ifndef MULTILIB_DEFAULTS
124 #define MULTILIB_DEFAULTS \
125 { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
126 #endif
127 \f
128
129 /* This outputs a lot of .req's to define alias for various registers.
130 Let's try to avoid this. */
131 #ifndef ASM_FILE_START
132 #define ASM_FILE_START(STREAM) \
133 do \
134 { \
135 fprintf (STREAM, "%s Generated by gcc %s for ARM/elf\n", \
136 ASM_COMMENT_START, version_string); \
137 output_file_directive (STREAM, main_input_filename); \
138 fprintf (STREAM, ASM_APP_OFF); \
139 } \
140 while (0)
141 #endif
142
143 /* Output an internal label definition. */
144 #undef ASM_OUTPUT_INTERNAL_LABEL
145 #define ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM) \
146 do \
147 { \
148 char * s = (char *) alloca (40 + strlen (PREFIX)); \
149 extern int arm_target_label, arm_ccfsm_state; \
150 extern rtx arm_target_insn; \
151 \
152 if (arm_ccfsm_state == 3 && arm_target_label == (NUM) \
153 && !strcmp (PREFIX, "L")) \
154 { \
155 arm_ccfsm_state = 0; \
156 arm_target_insn = NULL; \
157 } \
158 ASM_GENERATE_INTERNAL_LABEL (s, (PREFIX), (NUM)); \
159 ASM_OUTPUT_LABEL (STREAM, s); \
160 } \
161 while (0)
162 \f
163 #undef TARGET_ASM_NAMED_SECTION
164 #define TARGET_ASM_NAMED_SECTION arm_elf_asm_named_section
165 \f
166 #undef ASM_OUTPUT_ALIGNED_COMMON
167 #define ASM_OUTPUT_ALIGNED_COMMON(STREAM, NAME, SIZE, ALIGN) \
168 do \
169 { \
170 fprintf (STREAM, "\t.comm\t"); \
171 assemble_name (STREAM, NAME); \
172 fprintf (STREAM, ", %d, %d\n", SIZE, ALIGN); \
173 } \
174 while (0)
175
176 /* For PIC code we need to explicitly specify (PLT) and (GOT) relocs. */
177 #define NEED_PLT_RELOC flag_pic
178 #define NEED_GOT_RELOC flag_pic
179
180 /* The ELF assembler handles GOT addressing differently to NetBSD. */
181 #define GOT_PCREL 0
182
183 /* Biggest alignment supported by the object file format of this
184 machine. Use this macro to limit the alignment which can be
185 specified using the `__attribute__ ((aligned (N)))' construct. If
186 not defined, the default value is `BIGGEST_ALIGNMENT'. */
187 #define MAX_OFILE_ALIGNMENT (32768 * 8)
188
189 /* Align output to a power of two. Note ".align 0" is redundant,
190 and also GAS will treat it as ".align 2" which we do not want. */
191 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
192 do \
193 { \
194 if ((POWER) > 0) \
195 fprintf (STREAM, "\t.align\t%d\n", POWER); \
196 } \
197 while (0)
198
199 #define SUPPORTS_INIT_PRIORITY 1