* rtl.h (rtunion_def): Constify member `rtstr'.
[official-gcc.git] / gcc / config / arm / aout.h
blob850a681e0ffa4dd37264f403f04afe69d5a64acc
1 /* Definitions of target machine for GNU compiler, for ARM with a.out
2 Copyright (C) 1995, 1996, 1997, 1998 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 fprintf (STREAM,"%srfp\t.req\t%sr9\n", REGISTER_PREFIX, REGISTER_PREFIX); \
31 fprintf (STREAM,"%ssl\t.req\t%sr10\n", REGISTER_PREFIX, REGISTER_PREFIX); \
32 fprintf (STREAM,"%sfp\t.req\t%sr11\n", REGISTER_PREFIX, REGISTER_PREFIX); \
33 fprintf (STREAM,"%sip\t.req\t%sr12\n", REGISTER_PREFIX, REGISTER_PREFIX); \
34 fprintf (STREAM,"%ssp\t.req\t%sr13\n", REGISTER_PREFIX, REGISTER_PREFIX); \
35 fprintf (STREAM,"%slr\t.req\t%sr14\n", REGISTER_PREFIX, REGISTER_PREFIX); \
36 fprintf (STREAM,"%spc\t.req\t%sr15\n", REGISTER_PREFIX, REGISTER_PREFIX); \
38 #endif
40 #define ASM_APP_ON " "
41 #define ASM_APP_OFF " "
43 /* Switch to the text or data segment. */
44 #define TEXT_SECTION_ASM_OP ".text"
45 #define DATA_SECTION_ASM_OP ".data"
46 #define BSS_SECTION_ASM_OP ".bss"
48 /* Note: If USER_LABEL_PREFIX or LOCAL_LABEL_PREFIX are changed,
49 make sure that this change is reflected in the function
50 coff_arm_is_local_label_name() in bfd/coff-arm.c */
51 #ifndef REGISTER_PREFIX
52 #define REGISTER_PREFIX ""
53 #endif
55 #ifndef USER_LABEL_PREFIX
56 #define USER_LABEL_PREFIX "_"
57 #endif
59 #ifndef LOCAL_LABEL_PREFIX
60 #define LOCAL_LABEL_PREFIX ""
61 #endif
64 /* The assembler's names for the registers. */
65 #ifndef REGISTER_NAMES
66 #define REGISTER_NAMES \
67 { \
68 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
69 "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc", \
70 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
71 "cc", "sfp", "afp" \
73 #endif
75 #ifndef ADDITIONAL_REGISTER_NAMES
76 #define ADDITIONAL_REGISTER_NAMES \
77 { \
78 {"a1", 0}, \
79 {"a2", 1}, \
80 {"a3", 2}, \
81 {"a4", 3}, \
82 {"v1", 4}, \
83 {"v2", 5}, \
84 {"v3", 6}, \
85 {"v4", 7}, \
86 {"v5", 8}, \
87 {"v6", 9}, \
88 {"rfp", 9}, /* Gcc used to call it this */ \
89 {"sb", 9}, \
90 {"v7", 10}, \
91 {"r10", 10}, /* sl */ \
92 {"r11", 11}, /* fp */ \
93 {"r12", 12}, /* ip */ \
94 {"r13", 13}, /* sp */ \
95 {"r14", 14}, /* lr */ \
96 {"r15", 15} /* pc */ \
98 #endif
100 /* Arm Assembler barfs on dollars */
101 #define DOLLARS_IN_IDENTIFIERS 0
103 #define NO_DOLLAR_IN_LABEL 1
105 /* DBX register number for a given compiler register number */
106 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
108 /* Generate DBX debugging information. riscix.h will undefine this because
109 the native assembler does not support stabs. */
110 #ifndef DBX_DEBUGGING_INFO
111 #define DBX_DEBUGGING_INFO 1
112 #endif
114 /* Acorn dbx moans about continuation chars, so don't use any. */
115 #ifndef DBX_CONTIN_LENGTH
116 #define DBX_CONTIN_LENGTH 0
117 #endif
119 /* Output a source filename for the debugger. RISCiX dbx insists that the
120 ``desc'' field is set to compiler version number >= 315 (sic). */
121 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(STREAM, NAME) \
122 do \
124 fprintf (STREAM, ".stabs "); \
125 output_quoted_string (STREAM, NAME); \
126 fprintf (STREAM, ",%d,0,315,%s\n", N_SO, &ltext_label_name[1]); \
127 text_section (); \
128 ASM_OUTPUT_INTERNAL_LABEL (STREAM, "Ltext", 0); \
130 while (0)
132 /* Output a function label definition. */
133 #ifndef ASM_DECLARE_FUNCTION_NAME
134 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
135 do \
137 ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \
138 ASM_OUTPUT_LABEL (STREAM, NAME); \
140 while (0)
141 #endif
143 #ifndef ASM_OUTPUT_LABEL
144 #define ASM_OUTPUT_LABEL(STREAM, NAME) \
145 do \
147 assemble_name (STREAM,NAME); \
148 fputs (":\n", STREAM); \
150 while (0)
151 #endif
153 /* Output a globalising directive for a label. */
154 #ifndef ASM_GLOBALIZE_LABEL
155 #define ASM_GLOBALIZE_LABEL(STREAM, NAME) \
156 do \
158 fprintf (STREAM, "\t.global\t"); \
159 assemble_name (STREAM, NAME); \
160 fputc ('\n',STREAM); \
162 while (0)
163 #endif
165 /* Make an internal label into a string. */
166 #ifndef ASM_GENERATE_INTERNAL_LABEL
167 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
168 sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM))
169 #endif
171 /* Construct a private name. */
172 #define ASM_FORMAT_PRIVATE_NAME(OUTVAR, NAME, NUMBER) \
173 ((OUTVAR) = (char *) alloca (strlen (NAME) + 10), \
174 sprintf (OUTVAR, "%s.%d", NAME, NUMBER))
176 /* Output an element of a dispatch table. */
177 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
178 asm_fprintf (STREAM, "\t.word\t%LL%d\n", VALUE)
180 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
181 asm_fprintf (STREAM, "\tb\t%LL%d\n", VALUE)
183 /* Output various types of constants. For real numbers we output hex, with
184 a comment containing the "human" value, this allows us to pass NaN's which
185 the riscix assembler doesn't understand (it also makes cross-assembling
186 less likely to fail). */
188 #define ASM_OUTPUT_LONG_DOUBLE(STREAM, VALUE) \
189 do \
191 char dstr[30]; \
192 long l[3]; \
193 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
194 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
195 fprintf (STREAM, "\t.long 0x%lx,0x%lx,0x%lx\t%s long double %s\n", \
196 l[0], l[1], l[2], ASM_COMMENT_START, dstr); \
198 while (0)
200 #define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \
201 do \
203 char dstr[30]; \
204 long l[2]; \
205 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
206 REAL_VALUE_TO_DECIMAL (VALUE, "%.14g", dstr); \
207 fprintf (STREAM, "\t.long 0x%lx, 0x%lx\t%s double %s\n", l[0], \
208 l[1], ASM_COMMENT_START, dstr); \
210 while (0)
212 #define ASM_OUTPUT_FLOAT(STREAM, VALUE) \
213 do \
215 char dstr[30]; \
216 long l; \
217 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
218 REAL_VALUE_TO_DECIMAL (VALUE, "%.7g", dstr); \
219 fprintf (STREAM, "\t.word 0x%lx\t%s float %s\n", l, \
220 ASM_COMMENT_START, dstr); \
222 while (0)
224 #define ASM_OUTPUT_INT(STREAM, EXP) \
225 do \
227 fprintf (STREAM, "\t.word\t"); \
228 OUTPUT_INT_ADDR_CONST (STREAM, EXP); \
229 fputc ('\n', STREAM); \
231 while (0)
233 #define ASM_OUTPUT_SHORT(STREAM, EXP) \
234 do \
236 fprintf (STREAM, "\t.short\t"); \
237 output_addr_const (STREAM, EXP); \
238 fputc ('\n', STREAM); \
240 while (0)
242 #define ASM_OUTPUT_CHAR(STREAM, EXP) \
243 do \
245 fprintf (STREAM, "\t.byte\t"); \
246 output_addr_const (STREAM, EXP); \
247 fputc ('\n', STREAM); \
249 while (0)
251 #define ASM_OUTPUT_BYTE(STREAM, VALUE) \
252 fprintf (STREAM, "\t.byte\t%d\n", VALUE)
254 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
255 output_ascii_pseudo_op (STREAM, (const unsigned char *)(PTR), LEN)
257 /* Output a gap. In fact we fill it with nulls. */
258 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
259 fprintf (STREAM, "\t.space\t%d\n", NBYTES)
261 /* Align output to a power of two. Horrible /bin/as. */
262 #ifndef ASM_OUTPUT_ALIGN
263 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
264 do \
266 register int amount = 1 << (POWER); \
268 if (amount == 2) \
269 fprintf (STREAM, "\t.even\n"); \
270 else if (amount != 1) \
271 fprintf (STREAM, "\t.align\t%d\n", amount - 4); \
273 while (0)
274 #endif
276 /* Output a common block */
277 #ifndef ASM_OUTPUT_COMMON
278 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
279 do \
281 fprintf (STREAM, "\t.comm\t"); \
282 assemble_name (STREAM, NAME); \
283 fprintf (STREAM, ", %d\t%s %d\n", ROUNDED, \
284 ASM_COMMENT_START, SIZE); \
286 while (0)
287 #endif
289 /* Output a local common block. /bin/as can't do this, so hack a
290 `.space' into the bss segment. Note that this is *bad* practice,
291 which is guaranteed NOT to work since it doesn't define STATIC
292 COMMON space but merely STATIC BSS space. */
293 #ifndef ASM_OUTPUT_ALIGNED_LOCAL
294 #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
295 do \
297 bss_section (); \
298 ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
299 ASM_OUTPUT_LABEL (STREAM, NAME); \
300 fprintf (STREAM, "\t.space\t%d\n", SIZE); \
302 while (0)
303 #endif
305 /* Output a zero-initialized block. */
306 #ifndef ASM_OUTPUT_ALIGNED_BSS
307 #define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGN) \
308 asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGN)
309 #endif
311 /* Output a source line for the debugger. */
312 /* #define ASM_OUTPUT_SOURCE_LINE(STREAM,LINE) */
314 /* Output a #ident directive. */
315 #ifndef ASM_OUTPUT_IDENT
316 #define ASM_OUTPUT_IDENT(STREAM,STRING) \
317 fprintf (STREAM, "%s - - - ident %s\n", ASM_COMMENT_START, STRING)
318 #endif
320 /* The assembler's parentheses characters. */
321 #define ASM_OPEN_PAREN "("
322 #define ASM_CLOSE_PAREN ")"
324 #ifndef ASM_COMMENT_START
325 #define ASM_COMMENT_START "@"
326 #endif
328 /* This works for GAS and some other assemblers. */
329 #define SET_ASM_OP ".set"
331 #include "arm/arm.h"