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