]>
Commit | Line | Data |
---|---|---|
9fb7806b | 1 | /* Definitions of target machine for GNU compiler, for ARM with a.out |
2398fb2a RB |
2 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 |
3 | Free Software Foundation, Inc. | |
ae3e1bb4 | 4 | Contributed by Richard Earnshaw (rearnsha@armltd.co.uk). |
9fb7806b RE |
5 | |
6 | This file is part of GNU CC. | |
7 | ||
8 | GNU CC is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2, or (at your option) | |
11 | any later version. | |
12 | ||
13 | GNU CC is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GNU CC; see the file COPYING. If not, write to | |
20 | the Free Software Foundation, 59 Temple Place - Suite 330, | |
21 | Boston, MA 02111-1307, USA. */ | |
22 | ||
23 | #ifndef ARM_OS_NAME | |
24 | #define ARM_OS_NAME "(generic)" | |
25 | #endif | |
26 | ||
27 | /* The text to go at the start of the assembler file */ | |
b355a481 | 28 | #ifndef ASM_FILE_START |
d5b7b3ae RE |
29 | #define ASM_FILE_START(STREAM) \ |
30 | { \ | |
31 | asm_fprintf (STREAM,"%Rrfp\t.req\t%Rr9\n"); \ | |
32 | asm_fprintf (STREAM,"%Rsl\t.req\t%Rr10\n"); \ | |
33 | asm_fprintf (STREAM,"%Rfp\t.req\t%Rr11\n"); \ | |
34 | asm_fprintf (STREAM,"%Rip\t.req\t%Rr12\n"); \ | |
35 | asm_fprintf (STREAM,"%Rsp\t.req\t%Rr13\n"); \ | |
36 | asm_fprintf (STREAM,"%Rlr\t.req\t%Rr14\n"); \ | |
37 | asm_fprintf (STREAM,"%Rpc\t.req\t%Rr15\n"); \ | |
9fb7806b | 38 | } |
b355a481 | 39 | #endif |
9fb7806b | 40 | |
d5b7b3ae RE |
41 | #ifndef ASM_APP_ON |
42 | #define ASM_APP_ON "" | |
43 | #endif | |
44 | #ifndef ASM_APP_OFF | |
45 | #define ASM_APP_OFF "" | |
46 | #endif | |
9fb7806b RE |
47 | |
48 | /* Switch to the text or data segment. */ | |
93de6f51 HPN |
49 | #define TEXT_SECTION_ASM_OP "\t.text" |
50 | #define DATA_SECTION_ASM_OP "\t.data" | |
51 | #define BSS_SECTION_ASM_OP "\t.bss" | |
b355a481 NC |
52 | |
53 | /* Note: If USER_LABEL_PREFIX or LOCAL_LABEL_PREFIX are changed, | |
54 | make sure that this change is reflected in the function | |
55 | coff_arm_is_local_label_name() in bfd/coff-arm.c */ | |
56 | #ifndef REGISTER_PREFIX | |
57 | #define REGISTER_PREFIX "" | |
58 | #endif | |
59 | ||
60 | #ifndef USER_LABEL_PREFIX | |
61 | #define USER_LABEL_PREFIX "_" | |
62 | #endif | |
63 | ||
64 | #ifndef LOCAL_LABEL_PREFIX | |
65 | #define LOCAL_LABEL_PREFIX "" | |
66 | #endif | |
9fb7806b | 67 | |
9fb7806b RE |
68 | |
69 | /* The assembler's names for the registers. */ | |
70 | #ifndef REGISTER_NAMES | |
b355a481 | 71 | #define REGISTER_NAMES \ |
9fb7806b RE |
72 | { \ |
73 | "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ | |
74 | "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc", \ | |
75 | "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ | |
d5b7b3ae | 76 | "cc", "sfp", "afp" \ |
9fb7806b RE |
77 | } |
78 | #endif | |
79 | ||
80 | #ifndef ADDITIONAL_REGISTER_NAMES | |
81 | #define ADDITIONAL_REGISTER_NAMES \ | |
82 | { \ | |
83 | {"a1", 0}, \ | |
84 | {"a2", 1}, \ | |
85 | {"a3", 2}, \ | |
86 | {"a4", 3}, \ | |
87 | {"v1", 4}, \ | |
88 | {"v2", 5}, \ | |
89 | {"v3", 6}, \ | |
90 | {"v4", 7}, \ | |
91 | {"v5", 8}, \ | |
92 | {"v6", 9}, \ | |
93 | {"rfp", 9}, /* Gcc used to call it this */ \ | |
94 | {"sb", 9}, \ | |
95 | {"v7", 10}, \ | |
96 | {"r10", 10}, /* sl */ \ | |
97 | {"r11", 11}, /* fp */ \ | |
98 | {"r12", 12}, /* ip */ \ | |
99 | {"r13", 13}, /* sp */ \ | |
100 | {"r14", 14}, /* lr */ \ | |
101 | {"r15", 15} /* pc */ \ | |
102 | } | |
103 | #endif | |
104 | ||
105 | /* Arm Assembler barfs on dollars */ | |
106 | #define DOLLARS_IN_IDENTIFIERS 0 | |
107 | ||
be393ecf | 108 | #ifndef NO_DOLLAR_IN_LABEL |
6cfc7210 | 109 | #define NO_DOLLAR_IN_LABEL 1 |
be393ecf | 110 | #endif |
9fb7806b | 111 | |
9fb7806b RE |
112 | /* Generate DBX debugging information. riscix.h will undefine this because |
113 | the native assembler does not support stabs. */ | |
863ebdad | 114 | #ifndef DBX_DEBUGGING_INFO |
9fb7806b | 115 | #define DBX_DEBUGGING_INFO 1 |
863ebdad | 116 | #endif |
9fb7806b RE |
117 | |
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 | |
122 | ||
123 | /* Output a source filename for the debugger. RISCiX dbx insists that the | |
124 | ``desc'' field is set to compiler version number >= 315 (sic). */ | |
6cfc7210 NC |
125 | #define DBX_OUTPUT_MAIN_SOURCE_FILENAME(STREAM, NAME) \ |
126 | do \ | |
127 | { \ | |
128 | fprintf (STREAM, ".stabs "); \ | |
129 | output_quoted_string (STREAM, NAME); \ | |
130 | fprintf (STREAM, ",%d,0,315,%s\n", N_SO, <ext_label_name[1]); \ | |
131 | text_section (); \ | |
132 | ASM_OUTPUT_INTERNAL_LABEL (STREAM, "Ltext", 0); \ | |
133 | } \ | |
134 | while (0) | |
9fb7806b RE |
135 | |
136 | /* Output a function label definition. */ | |
b355a481 | 137 | #ifndef ASM_DECLARE_FUNCTION_NAME |
6cfc7210 NC |
138 | #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ |
139 | do \ | |
140 | { \ | |
141 | ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \ | |
142 | ASM_OUTPUT_LABEL (STREAM, NAME); \ | |
143 | } \ | |
144 | while (0) | |
b355a481 | 145 | #endif |
9fb7806b | 146 | |
b355a481 | 147 | #ifndef ASM_OUTPUT_LABEL |
6cfc7210 NC |
148 | #define ASM_OUTPUT_LABEL(STREAM, NAME) \ |
149 | do \ | |
150 | { \ | |
151 | assemble_name (STREAM,NAME); \ | |
152 | fputs (":\n", STREAM); \ | |
153 | } \ | |
154 | while (0) | |
b355a481 NC |
155 | #endif |
156 | ||
9fb7806b | 157 | /* Output a globalising directive for a label. */ |
b355a481 | 158 | #ifndef ASM_GLOBALIZE_LABEL |
6cfc7210 NC |
159 | #define ASM_GLOBALIZE_LABEL(STREAM, NAME) \ |
160 | do \ | |
161 | { \ | |
162 | fprintf (STREAM, "\t.global\t"); \ | |
163 | assemble_name (STREAM, NAME); \ | |
164 | fputc ('\n',STREAM); \ | |
165 | } \ | |
166 | while (0) | |
b355a481 | 167 | #endif |
9fb7806b | 168 | |
9fb7806b | 169 | /* Make an internal label into a string. */ |
b355a481 | 170 | #ifndef ASM_GENERATE_INTERNAL_LABEL |
9fb7806b | 171 | #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \ |
aec3cfba | 172 | sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM)) |
b355a481 NC |
173 | #endif |
174 | ||
9fb7806b | 175 | /* Construct a private name. */ |
6cfc7210 | 176 | #define ASM_FORMAT_PRIVATE_NAME(OUTVAR, NAME, NUMBER) \ |
9fb7806b | 177 | ((OUTVAR) = (char *) alloca (strlen (NAME) + 10), \ |
6cfc7210 | 178 | sprintf (OUTVAR, "%s.%d", NAME, NUMBER)) |
9fb7806b RE |
179 | |
180 | /* Output an element of a dispatch table. */ | |
6cfc7210 NC |
181 | #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ |
182 | asm_fprintf (STREAM, "\t.word\t%LL%d\n", VALUE) | |
9fb7806b | 183 | |
6cfc7210 NC |
184 | #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ |
185 | asm_fprintf (STREAM, "\tb\t%LL%d\n", VALUE) | |
9fb7806b | 186 | |
be393ecf | 187 | #undef ASM_OUTPUT_ASCII |
9fb7806b | 188 | #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \ |
3cce094d | 189 | output_ascii_pseudo_op (STREAM, (const unsigned char *)(PTR), LEN) |
9fb7806b RE |
190 | |
191 | /* Output a gap. In fact we fill it with nulls. */ | |
be393ecf | 192 | #undef ASM_OUTPUT_SKIP |
b355a481 | 193 | #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \ |
6cfc7210 | 194 | fprintf (STREAM, "\t.space\t%d\n", NBYTES) |
9fb7806b RE |
195 | |
196 | /* Align output to a power of two. Horrible /bin/as. */ | |
00275db1 | 197 | #ifndef ASM_OUTPUT_ALIGN |
6cfc7210 NC |
198 | #define ASM_OUTPUT_ALIGN(STREAM, POWER) \ |
199 | do \ | |
200 | { \ | |
201 | register int amount = 1 << (POWER); \ | |
202 | \ | |
203 | if (amount == 2) \ | |
204 | fprintf (STREAM, "\t.even\n"); \ | |
205 | else if (amount != 1) \ | |
206 | fprintf (STREAM, "\t.align\t%d\n", amount - 4); \ | |
207 | } \ | |
00275db1 PB |
208 | while (0) |
209 | #endif | |
9fb7806b RE |
210 | |
211 | /* Output a common block */ | |
b355a481 | 212 | #ifndef ASM_OUTPUT_COMMON |
6cfc7210 NC |
213 | #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ |
214 | do \ | |
215 | { \ | |
216 | fprintf (STREAM, "\t.comm\t"); \ | |
217 | assemble_name (STREAM, NAME); \ | |
d5b7b3ae RE |
218 | asm_fprintf (STREAM, ", %d\t%@ %d\n", \ |
219 | ROUNDED, SIZE); \ | |
6cfc7210 NC |
220 | } \ |
221 | while (0) | |
b355a481 NC |
222 | #endif |
223 | ||
33f7f353 | 224 | /* Output a local common block. /bin/as can't do this, so hack a |
b355a481 NC |
225 | `.space' into the bss segment. Note that this is *bad* practice, |
226 | which is guaranteed NOT to work since it doesn't define STATIC | |
227 | COMMON space but merely STATIC BSS space. */ | |
228 | #ifndef ASM_OUTPUT_ALIGNED_LOCAL | |
6cfc7210 NC |
229 | #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \ |
230 | do \ | |
231 | { \ | |
232 | bss_section (); \ | |
233 | ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \ | |
234 | ASM_OUTPUT_LABEL (STREAM, NAME); \ | |
235 | fprintf (STREAM, "\t.space\t%d\n", SIZE); \ | |
236 | } \ | |
237 | while (0) | |
b355a481 NC |
238 | #endif |
239 | ||
c9d9bc85 | 240 | /* Output a zero-initialized block. */ |
b355a481 | 241 | #ifndef ASM_OUTPUT_ALIGNED_BSS |
6cfc7210 | 242 | #define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGN) \ |
b355a481 NC |
243 | asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGN) |
244 | #endif | |
245 | ||
9fb7806b RE |
246 | /* Output a source line for the debugger. */ |
247 | /* #define ASM_OUTPUT_SOURCE_LINE(STREAM,LINE) */ | |
248 | ||
249 | /* Output a #ident directive. */ | |
b355a481 | 250 | #ifndef ASM_OUTPUT_IDENT |
9fb7806b | 251 | #define ASM_OUTPUT_IDENT(STREAM,STRING) \ |
d5b7b3ae | 252 | asm_fprintf (STREAM, "%@ - - - ident %s\n", STRING) |
b355a481 NC |
253 | #endif |
254 | ||
9fb7806b | 255 | #ifndef ASM_COMMENT_START |
b355a481 | 256 | #define ASM_COMMENT_START "@" |
9fb7806b RE |
257 | #endif |
258 | ||
ce29b9d0 | 259 | /* This works for GAS and some other assemblers. */ |
93de6f51 | 260 | #define SET_ASM_OP "\t.set\t" |