]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/arm/aout.h
config.gcc (arm*-*-rtems*, [...]): Include various CPU headers via tm_file.
[thirdparty/gcc.git] / gcc / config / arm / aout.h
1 /* Definitions of target machine for GNU compiler, for ARM with a.out
2 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
3 Free Software Foundation, Inc.
4 Contributed by Richard Earnshaw (rearnsha@armltd.co.uk).
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 #ifndef ARM_OS_NAME
24 #define ARM_OS_NAME "(generic)"
25 #endif
26
27 /* The text to go at the start of the assembler file */
28 #ifndef ASM_FILE_START
29 #define ASM_FILE_START(STREAM) \
30 { \
31 asm_fprintf (STREAM,"%Rrfp\t.req\t%Rr9\n"); \
32 asm_fprintf (STREAM,"%Rsl\t.req\t%Rr10\n"); \
33 asm_fprintf (STREAM,"%Rfp\t.req\t%Rr11\n"); \
34 asm_fprintf (STREAM,"%Rip\t.req\t%Rr12\n"); \
35 asm_fprintf (STREAM,"%Rsp\t.req\t%Rr13\n"); \
36 asm_fprintf (STREAM,"%Rlr\t.req\t%Rr14\n"); \
37 asm_fprintf (STREAM,"%Rpc\t.req\t%Rr15\n"); \
38 }
39 #endif
40
41 #ifndef ASM_APP_ON
42 #define ASM_APP_ON ""
43 #endif
44 #ifndef ASM_APP_OFF
45 #define ASM_APP_OFF ""
46 #endif
47
48 /* Switch to the text or data segment. */
49 #define TEXT_SECTION_ASM_OP "\t.text"
50 #define DATA_SECTION_ASM_OP "\t.data"
51 #define BSS_SECTION_ASM_OP "\t.bss"
52
53 /* Note: If USER_LABEL_PREFIX or LOCAL_LABEL_PREFIX are changed,
54 make sure that this change is reflected in the function
55 coff_arm_is_local_label_name() in bfd/coff-arm.c */
56 #ifndef REGISTER_PREFIX
57 #define REGISTER_PREFIX ""
58 #endif
59
60 #ifndef USER_LABEL_PREFIX
61 #define USER_LABEL_PREFIX "_"
62 #endif
63
64 #ifndef LOCAL_LABEL_PREFIX
65 #define LOCAL_LABEL_PREFIX ""
66 #endif
67
68
69 /* The assembler's names for the registers. */
70 #ifndef REGISTER_NAMES
71 #define REGISTER_NAMES \
72 { \
73 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
74 "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc", \
75 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
76 "cc", "sfp", "afp" \
77 }
78 #endif
79
80 #ifndef ADDITIONAL_REGISTER_NAMES
81 #define ADDITIONAL_REGISTER_NAMES \
82 { \
83 {"a1", 0}, \
84 {"a2", 1}, \
85 {"a3", 2}, \
86 {"a4", 3}, \
87 {"v1", 4}, \
88 {"v2", 5}, \
89 {"v3", 6}, \
90 {"v4", 7}, \
91 {"v5", 8}, \
92 {"v6", 9}, \
93 {"rfp", 9}, /* Gcc used to call it this */ \
94 {"sb", 9}, \
95 {"v7", 10}, \
96 {"r10", 10}, /* sl */ \
97 {"r11", 11}, /* fp */ \
98 {"r12", 12}, /* ip */ \
99 {"r13", 13}, /* sp */ \
100 {"r14", 14}, /* lr */ \
101 {"r15", 15} /* pc */ \
102 }
103 #endif
104
105 /* Arm Assembler barfs on dollars */
106 #define DOLLARS_IN_IDENTIFIERS 0
107
108 #ifndef NO_DOLLAR_IN_LABEL
109 #define NO_DOLLAR_IN_LABEL 1
110 #endif
111
112 /* DBX register number for a given compiler register number */
113 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
114
115 /* Generate DBX debugging information. riscix.h will undefine this because
116 the native assembler does not support stabs. */
117 #ifndef DBX_DEBUGGING_INFO
118 #define DBX_DEBUGGING_INFO 1
119 #endif
120
121 /* Acorn dbx moans about continuation chars, so don't use any. */
122 #ifndef DBX_CONTIN_LENGTH
123 #define DBX_CONTIN_LENGTH 0
124 #endif
125
126 /* Output a source filename for the debugger. RISCiX dbx insists that the
127 ``desc'' field is set to compiler version number >= 315 (sic). */
128 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(STREAM, NAME) \
129 do \
130 { \
131 fprintf (STREAM, ".stabs "); \
132 output_quoted_string (STREAM, NAME); \
133 fprintf (STREAM, ",%d,0,315,%s\n", N_SO, &ltext_label_name[1]); \
134 text_section (); \
135 ASM_OUTPUT_INTERNAL_LABEL (STREAM, "Ltext", 0); \
136 } \
137 while (0)
138
139 /* Output a function label definition. */
140 #ifndef ASM_DECLARE_FUNCTION_NAME
141 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
142 do \
143 { \
144 ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \
145 ASM_OUTPUT_LABEL (STREAM, NAME); \
146 } \
147 while (0)
148 #endif
149
150 #ifndef ASM_OUTPUT_LABEL
151 #define ASM_OUTPUT_LABEL(STREAM, NAME) \
152 do \
153 { \
154 assemble_name (STREAM,NAME); \
155 fputs (":\n", STREAM); \
156 } \
157 while (0)
158 #endif
159
160 /* Output a globalising directive for a label. */
161 #ifndef ASM_GLOBALIZE_LABEL
162 #define ASM_GLOBALIZE_LABEL(STREAM, NAME) \
163 do \
164 { \
165 fprintf (STREAM, "\t.global\t"); \
166 assemble_name (STREAM, NAME); \
167 fputc ('\n',STREAM); \
168 } \
169 while (0)
170 #endif
171
172 /* Make an internal label into a string. */
173 #ifndef ASM_GENERATE_INTERNAL_LABEL
174 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
175 sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM))
176 #endif
177
178 /* Construct a private name. */
179 #define ASM_FORMAT_PRIVATE_NAME(OUTVAR, NAME, NUMBER) \
180 ((OUTVAR) = (char *) alloca (strlen (NAME) + 10), \
181 sprintf (OUTVAR, "%s.%d", NAME, NUMBER))
182
183 /* Output an element of a dispatch table. */
184 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
185 asm_fprintf (STREAM, "\t.word\t%LL%d\n", VALUE)
186
187 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
188 asm_fprintf (STREAM, "\tb\t%LL%d\n", VALUE)
189
190 /* Output various types of constants. For real numbers we output hex, with
191 a comment containing the "human" value, this allows us to pass NaN's which
192 the riscix assembler doesn't understand (it also makes cross-assembling
193 less likely to fail). */
194
195 #define ASM_OUTPUT_LONG_DOUBLE(STREAM, VALUE) \
196 do \
197 { \
198 char dstr[30]; \
199 long l[3]; \
200 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
201 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
202 asm_fprintf (STREAM, \
203 "\t.long 0x%lx,0x%lx,0x%lx\t%@ long double %s\n", \
204 l[0], l[1], l[2], dstr); \
205 } \
206 while (0)
207
208 #define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \
209 do \
210 { \
211 char dstr[30]; \
212 long l[2]; \
213 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
214 REAL_VALUE_TO_DECIMAL (VALUE, "%.14g", dstr); \
215 asm_fprintf (STREAM, "\t.long 0x%lx, 0x%lx\t%@ double %s\n", l[0],\
216 l[1], dstr); \
217 } \
218 while (0)
219
220 #define ASM_OUTPUT_FLOAT(STREAM, VALUE) \
221 do \
222 { \
223 char dstr[30]; \
224 long l; \
225 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
226 REAL_VALUE_TO_DECIMAL (VALUE, "%.7g", dstr); \
227 asm_fprintf (STREAM, "\t.word 0x%lx\t%@ float %s\n", l, \
228 dstr); \
229 } \
230 while (0)
231
232 #define ASM_OUTPUT_INT(STREAM, EXP) \
233 do \
234 { \
235 fprintf (STREAM, "\t.word\t"); \
236 OUTPUT_INT_ADDR_CONST (STREAM, EXP); \
237 fputc ('\n', STREAM); \
238 } \
239 while (0)
240
241 #define ASM_OUTPUT_SHORT(STREAM, EXP) \
242 do \
243 { \
244 fprintf (STREAM, "\t.short\t"); \
245 output_addr_const (STREAM, EXP); \
246 fputc ('\n', STREAM); \
247 } \
248 while (0)
249
250 #define ASM_OUTPUT_CHAR(STREAM, EXP) \
251 do \
252 { \
253 fprintf (STREAM, "\t.byte\t"); \
254 output_addr_const (STREAM, EXP); \
255 fputc ('\n', STREAM); \
256 } \
257 while (0)
258
259 #define ASM_OUTPUT_BYTE(STREAM, VALUE) \
260 fprintf (STREAM, "\t.byte\t%d\n", VALUE)
261
262 #undef ASM_OUTPUT_ASCII
263 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
264 output_ascii_pseudo_op (STREAM, (const unsigned char *)(PTR), LEN)
265
266 /* Output a gap. In fact we fill it with nulls. */
267 #undef ASM_OUTPUT_SKIP
268 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
269 fprintf (STREAM, "\t.space\t%d\n", NBYTES)
270
271 /* Align output to a power of two. Horrible /bin/as. */
272 #ifndef ASM_OUTPUT_ALIGN
273 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
274 do \
275 { \
276 register int amount = 1 << (POWER); \
277 \
278 if (amount == 2) \
279 fprintf (STREAM, "\t.even\n"); \
280 else if (amount != 1) \
281 fprintf (STREAM, "\t.align\t%d\n", amount - 4); \
282 } \
283 while (0)
284 #endif
285
286 /* Output a common block */
287 #ifndef ASM_OUTPUT_COMMON
288 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
289 do \
290 { \
291 fprintf (STREAM, "\t.comm\t"); \
292 assemble_name (STREAM, NAME); \
293 asm_fprintf (STREAM, ", %d\t%@ %d\n", \
294 ROUNDED, SIZE); \
295 } \
296 while (0)
297 #endif
298
299 /* Output a local common block. /bin/as can't do this, so hack a
300 `.space' into the bss segment. Note that this is *bad* practice,
301 which is guaranteed NOT to work since it doesn't define STATIC
302 COMMON space but merely STATIC BSS space. */
303 #ifndef ASM_OUTPUT_ALIGNED_LOCAL
304 #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
305 do \
306 { \
307 bss_section (); \
308 ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
309 ASM_OUTPUT_LABEL (STREAM, NAME); \
310 fprintf (STREAM, "\t.space\t%d\n", SIZE); \
311 } \
312 while (0)
313 #endif
314
315 /* Output a zero-initialized block. */
316 #ifndef ASM_OUTPUT_ALIGNED_BSS
317 #define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGN) \
318 asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGN)
319 #endif
320
321 /* Output a source line for the debugger. */
322 /* #define ASM_OUTPUT_SOURCE_LINE(STREAM,LINE) */
323
324 /* Output a #ident directive. */
325 #ifndef ASM_OUTPUT_IDENT
326 #define ASM_OUTPUT_IDENT(STREAM,STRING) \
327 asm_fprintf (STREAM, "%@ - - - ident %s\n", STRING)
328 #endif
329
330 #ifndef ASM_COMMENT_START
331 #define ASM_COMMENT_START "@"
332 #endif
333
334 /* This works for GAS and some other assemblers. */
335 #define SET_ASM_OP "\t.set\t"