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