* aout.h (ASM_OUTPUT_MI_THUNK): Delete.
[official-gcc.git] / gcc / config / arm / aout.h
blobb47fada92b3515478880b76a2e6f4cf5f0d3678d
1 /* Definitions of target machine for GNU compiler, for ARM with a.out
2 Copyright (C) 1995, 1996 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 #define ASM_OUTPUT_OPTIONS(FILE) \
27 output_options(FILE, \
28 f_options, sizeof (f_options) / sizeof (f_options[0]), \
29 W_options, sizeof (W_options) / sizeof (W_options[0]))
31 /* The text to go at the start of the assembler file */
32 #define ASM_FILE_START(STREAM) \
33 { \
34 extern char *version_string; \
35 fprintf (STREAM,"%s Generated by gcc %s for ARM/%s\n", \
36 ASM_COMMENT_START, version_string, ARM_OS_NAME); \
37 ASM_OUTPUT_OPTIONS(STREAM); \
38 fprintf (STREAM,"%srfp\t.req\t%sr9\n", REGISTER_PREFIX, REGISTER_PREFIX); \
39 fprintf (STREAM,"%ssl\t.req\t%sr10\n", REGISTER_PREFIX, REGISTER_PREFIX); \
40 fprintf (STREAM,"%sfp\t.req\t%sr11\n", REGISTER_PREFIX, REGISTER_PREFIX); \
41 fprintf (STREAM,"%sip\t.req\t%sr12\n", REGISTER_PREFIX, REGISTER_PREFIX); \
42 fprintf (STREAM,"%ssp\t.req\t%sr13\n", REGISTER_PREFIX, REGISTER_PREFIX); \
43 fprintf (STREAM,"%slr\t.req\t%sr14\n", REGISTER_PREFIX, REGISTER_PREFIX); \
44 fprintf (STREAM,"%spc\t.req\t%sr15\n", REGISTER_PREFIX, REGISTER_PREFIX); \
47 #define ASM_APP_ON ""
48 #define ASM_APP_OFF ""
50 /* Switch to the text or data segment. */
51 #define TEXT_SECTION_ASM_OP ".text"
52 #define DATA_SECTION_ASM_OP ".data"
53 #define BSS_SECTION_ASM_OP ".bss"
55 #define REGISTER_PREFIX ""
56 #define USER_LABEL_PREFIX "_"
57 #define LOCAL_LABEL_PREFIX ""
59 /* The assembler's names for the registers. */
60 #ifndef REGISTER_NAMES
61 #define REGISTER_NAMES \
62 { \
63 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
64 "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc", \
65 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
66 "cc", "sfp", "afp" \
68 #endif
70 #ifndef ADDITIONAL_REGISTER_NAMES
71 #define ADDITIONAL_REGISTER_NAMES \
72 { \
73 {"a1", 0}, \
74 {"a2", 1}, \
75 {"a3", 2}, \
76 {"a4", 3}, \
77 {"v1", 4}, \
78 {"v2", 5}, \
79 {"v3", 6}, \
80 {"v4", 7}, \
81 {"v5", 8}, \
82 {"v6", 9}, \
83 {"rfp", 9}, /* Gcc used to call it this */ \
84 {"sb", 9}, \
85 {"v7", 10}, \
86 {"r10", 10}, /* sl */ \
87 {"r11", 11}, /* fp */ \
88 {"r12", 12}, /* ip */ \
89 {"r13", 13}, /* sp */ \
90 {"r14", 14}, /* lr */ \
91 {"r15", 15} /* pc */ \
93 #endif
95 /* Arm Assembler barfs on dollars */
96 #define DOLLARS_IN_IDENTIFIERS 0
98 #define NO_DOLLAR_IN_LABEL
100 /* DBX register number for a given compiler register number */
101 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
103 /* Generate DBX debugging information. riscix.h will undefine this because
104 the native assembler does not support stabs. */
105 #define DBX_DEBUGGING_INFO 1
107 /* Acorn dbx moans about continuation chars, so don't use any. */
108 #ifndef DBX_CONTIN_LENGTH
109 #define DBX_CONTIN_LENGTH 0
110 #endif
112 /* Output a source filename for the debugger. RISCiX dbx insists that the
113 ``desc'' field is set to compiler version number >= 315 (sic). */
114 #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(STREAM,NAME) \
115 do { \
116 fprintf (STREAM, ".stabs \"%s\",%d,0,315,%s\n", (NAME), N_SO, \
117 &ltext_label_name[1]); \
118 text_section (); \
119 ASM_OUTPUT_INTERNAL_LABEL (STREAM, "Ltext", 0); \
120 } while (0)
122 /* Output a function label definition. */
123 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
124 ASM_OUTPUT_LABEL(STREAM, NAME)
126 #define ARM_OUTPUT_LABEL(STREAM,NAME) \
127 do { \
128 assemble_name (STREAM,NAME); \
129 fputs (":\n", STREAM); \
130 } while (0)
132 /* Output a globalising directive for a label. */
133 #define ASM_GLOBALIZE_LABEL(STREAM,NAME) \
134 (fprintf (STREAM, "\t.global\t"), \
135 assemble_name (STREAM, NAME), \
136 fputc ('\n',STREAM)) \
138 /* Output a reference to a label. */
139 #define ASM_OUTPUT_LABELREF(STREAM,NAME) \
140 fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, NAME)
142 /* Make an internal label into a string. */
143 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
144 sprintf (STRING, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
146 /* Nothing special is done about jump tables */
147 /* #define ASM_OUTPUT_CASE_LABEL(STREAM,PREFIX,NUM,TABLE) */
148 /* #define ASM_OUTPUT_CASE_END(STREAM,NUM,TABLE) */
150 /* Construct a private name. */
151 #define ASM_FORMAT_PRIVATE_NAME(OUTVAR,NAME,NUMBER) \
152 ((OUTVAR) = (char *) alloca (strlen (NAME) + 10), \
153 sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER)))
155 /* Output an element of a dispatch table. */
156 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE) \
157 fprintf (STREAM, "\t.word\t%sL%d\n", LOCAL_LABEL_PREFIX, VALUE)
159 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,VALUE,REL) \
160 fprintf (STREAM, "\tb\t%sL%d\n", LOCAL_LABEL_PREFIX, (VALUE))
162 /* Output various types of constants. For real numbers we output hex, with
163 a comment containing the "human" value, this allows us to pass NaN's which
164 the riscix assembler doesn't understand (it also makes cross-assembling
165 less likely to fail). */
167 #define ASM_OUTPUT_LONG_DOUBLE(STREAM,VALUE) \
168 do { char dstr[30]; \
169 long l[3]; \
170 arm_increase_location (12); \
171 REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l); \
172 REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr); \
173 fprintf (STREAM, "\t.long 0x%lx,0x%lx,0x%lx\t%s long double %s\n", \
174 l[0], l[1], l[2], ASM_COMMENT_START, dstr); \
175 } while (0)
178 #define ASM_OUTPUT_DOUBLE(STREAM, VALUE) \
179 do { char dstr[30]; \
180 long l[2]; \
181 arm_increase_location (8); \
182 REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l); \
183 REAL_VALUE_TO_DECIMAL (VALUE, "%.14g", dstr); \
184 fprintf (STREAM, "\t.long 0x%lx, 0x%lx\t%s double %s\n", l[0], \
185 l[1], ASM_COMMENT_START, dstr); \
186 } while (0)
188 #define ASM_OUTPUT_FLOAT(STREAM, VALUE) \
189 do { char dstr[30]; \
190 long l; \
191 arm_increase_location (4); \
192 REAL_VALUE_TO_TARGET_SINGLE (VALUE, l); \
193 REAL_VALUE_TO_DECIMAL (VALUE, "%.7g", dstr); \
194 fprintf (STREAM, "\t.word 0x%lx\t%s float %s\n", l, \
195 ASM_COMMENT_START, dstr); \
196 } while (0);
198 #define ASM_OUTPUT_INT(STREAM, EXP) \
199 (fprintf (STREAM, "\t.word\t"), \
200 output_addr_const (STREAM, (EXP)), \
201 arm_increase_location (4), \
202 fputc ('\n', STREAM))
204 #define ASM_OUTPUT_SHORT(STREAM, EXP) \
205 (fprintf (STREAM, "\t.short\t"), \
206 output_addr_const (STREAM, (EXP)), \
207 arm_increase_location (2), \
208 fputc ('\n', STREAM))
210 #define ASM_OUTPUT_CHAR(STREAM, EXP) \
211 (fprintf (STREAM, "\t.byte\t"), \
212 output_addr_const (STREAM, (EXP)), \
213 arm_increase_location (1), \
214 fputc ('\n', STREAM))
216 #define ASM_OUTPUT_BYTE(STREAM, VALUE) \
217 (fprintf (STREAM, "\t.byte\t%d\n", VALUE), \
218 arm_increase_location (1))
220 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
221 output_ascii_pseudo_op ((STREAM), (unsigned char *)(PTR), (LEN))
223 /* Output a gap. In fact we fill it with nulls. */
224 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
225 (arm_increase_location (NBYTES), \
226 fprintf (STREAM, "\t.space\t%d\n", NBYTES))
228 /* Align output to a power of two. Horrible /bin/as. */
229 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
230 do \
232 register int amount = 1 << (POWER); \
233 extern int arm_text_location; \
235 if (amount == 2) \
236 fprintf (STREAM, "\t.even\n"); \
237 else if (amount != 1) \
238 fprintf (STREAM, "\t.align\t%d\n", amount - 4); \
240 if (in_text_section ()) \
241 arm_text_location = ((arm_text_location + amount - 1) \
242 & ~(amount - 1)); \
243 } while (0)
245 /* Output a common block */
246 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
247 (fprintf (STREAM, "\t.comm\t"), \
248 assemble_name ((STREAM), (NAME)), \
249 fprintf(STREAM, ", %d\t%s %d\n", ROUNDED, ASM_COMMENT_START, SIZE))
251 /* Output a local common block. /bin/as can't do this, so hack a `.space' into
252 the bss segment. Note that this is *bad* practice. */
253 #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM,NAME,SIZE,ALIGN) \
254 output_lcomm_directive (STREAM, NAME, SIZE, ALIGN)
256 /* Output a zero-initialized block. */
257 #define ASM_OUTPUT_ALIGNED_BSS(STREAM,NAME,SIZE,ALIGN) \
258 asm_output_aligned_bss(STREAM, NAME, SIZE, ALIGN)
260 /* Output a source line for the debugger. */
261 /* #define ASM_OUTPUT_SOURCE_LINE(STREAM,LINE) */
263 /* Output a #ident directive. */
264 #define ASM_OUTPUT_IDENT(STREAM,STRING) \
265 fprintf (STREAM,"- - - ident %s\n",STRING)
267 /* The assembler's parentheses characters. */
268 #define ASM_OPEN_PAREN "("
269 #define ASM_CLOSE_PAREN ")"
271 #ifndef ASM_COMMENT_START
272 #define ASM_COMMENT_START "@"
273 #endif
275 #include "arm/arm.h"