OSDN Git Service

* arm/aout.h (ASM_OUTPUT_OPTIONS): Delete.
[pf3gnuchains/gcc-fork.git] / gcc / config / arm / aout.h
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)
4    
5 This file is part of GNU CC.
6
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.
11
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.
16
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.  */
21
22 #ifndef ARM_OS_NAME
23 #define ARM_OS_NAME "(generic)"
24 #endif
25
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); \
36 }
37
38 #define ASM_APP_ON  ""
39 #define ASM_APP_OFF  ""
40
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"
45
46 #define REGISTER_PREFIX ""
47 #define USER_LABEL_PREFIX "_"
48 #define LOCAL_LABEL_PREFIX ""
49
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"                               \
58 }
59 #endif
60
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 */                        \
83 }
84 #endif
85
86 /* Arm Assembler barfs on dollars */
87 #define DOLLARS_IN_IDENTIFIERS 0
88
89 #define NO_DOLLAR_IN_LABEL
90
91 /* DBX register number for a given compiler register number */
92 #define DBX_REGISTER_NUMBER(REGNO)  (REGNO)
93
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
97
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
102
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)
112   
113 /* Output a function label definition.  */
114 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
115     ASM_OUTPUT_LABEL(STREAM, NAME)
116
117 #define ARM_OUTPUT_LABEL(STREAM,NAME)   \
118 do {                                    \
119   assemble_name (STREAM,NAME);          \
120   fputs (":\n", STREAM);                \
121 } while (0)
122
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))                   \
128
129 /* Output a reference to a label.  */
130 #define ASM_OUTPUT_LABELREF(STREAM,NAME)  \
131   fprintf (STREAM, "%s%s", USER_LABEL_PREFIX, NAME)
132
133 /* Make an internal label into a string.  */
134 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM)  \
135   sprintf (STRING, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM)
136
137 /* Nothing special is done about jump tables */
138 /* #define ASM_OUTPUT_CASE_LABEL(STREAM,PREFIX,NUM,TABLE)   */
139 /* #define ASM_OUTPUT_CASE_END(STREAM,NUM,TABLE)            */
140
141 /* Construct a private name.  */
142 #define ASM_FORMAT_PRIVATE_NAME(OUTVAR,NAME,NUMBER)  \
143   ((OUTVAR) = (char *) alloca (strlen (NAME) + 10),  \
144    sprintf ((OUTVAR), "%s.%d", (NAME), (NUMBER)))
145
146 /* Output an element of a dispatch table.  */
147 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM,VALUE)  \
148    fprintf (STREAM, "\t.word\t%sL%d\n", LOCAL_LABEL_PREFIX, VALUE)
149
150 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM,VALUE,REL)  \
151    fprintf (STREAM, "\tb\t%sL%d\n", LOCAL_LABEL_PREFIX, (VALUE))
152
153 /* Output various types of constants.  For real numbers we output hex, with
154    a comment containing the "human" value, this allows us to pass NaN's which
155    the riscix assembler doesn't understand (it also makes cross-assembling
156    less likely to fail). */
157
158 #define ASM_OUTPUT_LONG_DOUBLE(STREAM,VALUE)                            \
159 do { char dstr[30];                                                     \
160      long l[3];                                                         \
161      arm_increase_location (12);                                        \
162      REAL_VALUE_TO_TARGET_LONG_DOUBLE (VALUE, l);                       \
163      REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);                      \
164      fprintf (STREAM, "\t.long 0x%lx,0x%lx,0x%lx\t%s long double %s\n", \
165               l[0], l[1], l[2], ASM_COMMENT_START, dstr);               \
166    } while (0)
167
168     
169 #define ASM_OUTPUT_DOUBLE(STREAM, VALUE)                                \
170 do { char dstr[30];                                                     \
171      long l[2];                                                         \
172      arm_increase_location (8);                                         \
173      REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l);                            \
174      REAL_VALUE_TO_DECIMAL (VALUE, "%.14g", dstr);                      \
175      fprintf (STREAM, "\t.long 0x%lx, 0x%lx\t%s double %s\n", l[0],     \
176               l[1], ASM_COMMENT_START, dstr);                           \
177    } while (0)
178
179 #define ASM_OUTPUT_FLOAT(STREAM, VALUE)                                 \
180 do { char dstr[30];                                                     \
181      long l;                                                            \
182      arm_increase_location (4);                                         \
183      REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);                            \
184      REAL_VALUE_TO_DECIMAL (VALUE, "%.7g", dstr);                       \
185      fprintf (STREAM, "\t.word 0x%lx\t%s float %s\n", l,                \
186               ASM_COMMENT_START, dstr);                                 \
187    } while (0);
188
189 #define ASM_OUTPUT_INT(STREAM, EXP)     \
190   (fprintf (STREAM, "\t.word\t"),       \
191    output_addr_const (STREAM, (EXP)),   \
192    arm_increase_location (4),           \
193    fputc ('\n', STREAM))
194
195 #define ASM_OUTPUT_SHORT(STREAM, EXP)  \
196   (fprintf (STREAM, "\t.short\t"),     \
197    output_addr_const (STREAM, (EXP)),  \
198    arm_increase_location (2),          \
199    fputc ('\n', STREAM))
200
201 #define ASM_OUTPUT_CHAR(STREAM, EXP)  \
202   (fprintf (STREAM, "\t.byte\t"),      \
203    output_addr_const (STREAM, (EXP)),  \
204    arm_increase_location (1),          \
205    fputc ('\n', STREAM))
206
207 #define ASM_OUTPUT_BYTE(STREAM, VALUE)  \
208   (fprintf (STREAM, "\t.byte\t%d\n", VALUE),  \
209    arm_increase_location (1))
210
211 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN)  \
212   output_ascii_pseudo_op ((STREAM), (unsigned char *)(PTR), (LEN))
213
214 /* Output a gap.  In fact we fill it with nulls.  */
215 #define ASM_OUTPUT_SKIP(STREAM, NBYTES)  \
216   (arm_increase_location (NBYTES),              \
217    fprintf (STREAM, "\t.space\t%d\n", NBYTES))
218
219 /* Align output to a power of two.  Horrible /bin/as.  */
220 #define ASM_OUTPUT_ALIGN(STREAM, POWER)  \
221   do                                                           \
222     {                                                          \
223       register int amount = 1 << (POWER);                      \
224       extern int arm_text_location;                            \
225                                                                \
226       if (amount == 2)                                         \
227         fprintf (STREAM, "\t.even\n");                         \
228       else if (amount != 1)                                    \
229         fprintf (STREAM, "\t.align\t%d\n", amount - 4);        \
230                                                                \
231       if (in_text_section ())                                  \
232         arm_text_location = ((arm_text_location + amount - 1)  \
233                              & ~(amount - 1));                 \
234     } while (0)
235
236 /* Output a common block */
237 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED)                  \
238   (fprintf (STREAM, "\t.comm\t"),                                       \
239    assemble_name ((STREAM), (NAME)),                                    \
240    fprintf(STREAM, ", %d\t%s %d\n", ROUNDED, ASM_COMMENT_START, SIZE))
241
242 /* Output a local common block.  /bin/as can't do this, so hack a `.space' into
243    the bss segment.  Note that this is *bad* practice.  */
244 #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM,NAME,SIZE,ALIGN)  \
245   output_lcomm_directive (STREAM, NAME, SIZE, ALIGN)
246
247 /* Output a zero-initialized block.  */
248 #define ASM_OUTPUT_ALIGNED_BSS(STREAM,NAME,SIZE,ALIGN) \
249   asm_output_aligned_bss(STREAM, NAME, SIZE, ALIGN)
250
251 /* Output a source line for the debugger.  */
252 /* #define ASM_OUTPUT_SOURCE_LINE(STREAM,LINE) */
253
254 /* Output a #ident directive.  */
255 #define ASM_OUTPUT_IDENT(STREAM,STRING)  \
256   fprintf (STREAM,"- - - ident %s\n",STRING)
257
258 /* The assembler's parentheses characters.  */
259 #define ASM_OPEN_PAREN "("
260 #define ASM_CLOSE_PAREN ")"
261
262 #ifndef ASM_COMMENT_START
263 #define ASM_COMMENT_START "@"
264 #endif
265
266 #include "arm/arm.h"