gcc/
[official-gcc.git] / gcc / config / arm / aout.h
blobce477dba5fd076fbabfb899846e13759f38e55d4
1 /* Definitions of target machine for GNU compiler, for ARM with a.out
2 Copyright (C) 1995-2014 Free Software Foundation, Inc.
3 Contributed by Richard Earnshaw (rearnsha@armltd.co.uk).
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published
9 by the Free Software Foundation; either version 3, or (at your
10 option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License
22 along with GCC; see the file COPYING3. If not see
23 <http://www.gnu.org/licenses/>. */
25 #ifndef ASM_APP_ON
26 #define ASM_APP_ON ""
27 #endif
28 #ifndef ASM_APP_OFF
29 #define ASM_APP_OFF ""
30 #endif
32 /* Switch to the text or data segment. */
33 #define TEXT_SECTION_ASM_OP "\t.text"
34 #define DATA_SECTION_ASM_OP "\t.data"
35 #define BSS_SECTION_ASM_OP "\t.bss"
37 /* Note: If USER_LABEL_PREFIX or LOCAL_LABEL_PREFIX are changed,
38 make sure that this change is reflected in the function
39 coff_arm_is_local_label_name() in bfd/coff-arm.c. */
40 #ifndef REGISTER_PREFIX
41 #define REGISTER_PREFIX ""
42 #endif
44 #ifndef USER_LABEL_PREFIX
45 #define USER_LABEL_PREFIX "_"
46 #endif
48 #ifndef LOCAL_LABEL_PREFIX
49 #define LOCAL_LABEL_PREFIX ""
50 #endif
52 /* The assembler's names for the registers. Note that the ?xx registers are
53 there so that VFPv3/NEON registers D16-D31 have the same spacing as D0-D15
54 (each of which is overlaid on two S registers), although there are no
55 actual single-precision registers which correspond to D16-D31. */
56 #ifndef REGISTER_NAMES
57 #define REGISTER_NAMES \
58 { \
59 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
60 "r8", "r9", "r10", "fp", "ip", "sp", "lr", "pc", \
61 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
62 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", \
63 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", \
64 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", \
65 "d16", "?16", "d17", "?17", "d18", "?18", "d19", "?19", \
66 "d20", "?20", "d21", "?21", "d22", "?22", "d23", "?23", \
67 "d24", "?24", "d25", "?25", "d26", "?26", "d27", "?27", \
68 "d28", "?28", "d29", "?29", "d30", "?30", "d31", "?31", \
69 "wr0", "wr1", "wr2", "wr3", \
70 "wr4", "wr5", "wr6", "wr7", \
71 "wr8", "wr9", "wr10", "wr11", \
72 "wr12", "wr13", "wr14", "wr15", \
73 "wcgr0", "wcgr1", "wcgr2", "wcgr3", \
74 "cc", "vfpcc", "sfp", "afp" \
76 #endif
78 #ifndef ADDITIONAL_REGISTER_NAMES
79 #define ADDITIONAL_REGISTER_NAMES \
80 { \
81 {"a1", 0}, \
82 {"a2", 1}, \
83 {"a3", 2}, \
84 {"a4", 3}, \
85 {"v1", 4}, \
86 {"v2", 5}, \
87 {"v3", 6}, \
88 {"v4", 7}, \
89 {"v5", 8}, \
90 {"v6", 9}, \
91 {"rfp", 9}, /* Historical. */ \
92 {"sb", 9}, /* Historical. */ \
93 {"v7", 10}, \
94 {"sl", 10}, /* Historical. */ \
95 {"r11", 11}, /* fp */ \
96 {"r12", 12}, /* ip */ \
97 {"r13", 13}, /* sp */ \
98 {"r14", 14}, /* lr */ \
99 {"r15", 15} /* pc */ \
101 #endif
103 #ifndef OVERLAPPING_REGISTER_NAMES
104 #define OVERLAPPING_REGISTER_NAMES \
106 {"d0", FIRST_VFP_REGNUM + 0, 2}, \
107 {"d1", FIRST_VFP_REGNUM + 2, 2}, \
108 {"d2", FIRST_VFP_REGNUM + 4, 2}, \
109 {"d3", FIRST_VFP_REGNUM + 6, 2}, \
110 {"d4", FIRST_VFP_REGNUM + 8, 2}, \
111 {"d5", FIRST_VFP_REGNUM + 10, 2}, \
112 {"d6", FIRST_VFP_REGNUM + 12, 2}, \
113 {"d7", FIRST_VFP_REGNUM + 14, 2}, \
114 {"d8", FIRST_VFP_REGNUM + 16, 2}, \
115 {"d9", FIRST_VFP_REGNUM + 18, 2}, \
116 {"d10", FIRST_VFP_REGNUM + 20, 2}, \
117 {"d11", FIRST_VFP_REGNUM + 22, 2}, \
118 {"d12", FIRST_VFP_REGNUM + 24, 2}, \
119 {"d13", FIRST_VFP_REGNUM + 26, 2}, \
120 {"d14", FIRST_VFP_REGNUM + 28, 2}, \
121 {"d15", FIRST_VFP_REGNUM + 30, 2}, \
122 {"q0", FIRST_VFP_REGNUM + 0, 4}, \
123 {"q1", FIRST_VFP_REGNUM + 4, 4}, \
124 {"q2", FIRST_VFP_REGNUM + 8, 4}, \
125 {"q3", FIRST_VFP_REGNUM + 12, 4}, \
126 {"q4", FIRST_VFP_REGNUM + 16, 4}, \
127 {"q5", FIRST_VFP_REGNUM + 20, 4}, \
128 {"q6", FIRST_VFP_REGNUM + 24, 4}, \
129 {"q7", FIRST_VFP_REGNUM + 28, 4}, \
130 {"q8", FIRST_VFP_REGNUM + 32, 4}, \
131 {"q9", FIRST_VFP_REGNUM + 36, 4}, \
132 {"q10", FIRST_VFP_REGNUM + 40, 4}, \
133 {"q11", FIRST_VFP_REGNUM + 44, 4}, \
134 {"q12", FIRST_VFP_REGNUM + 48, 4}, \
135 {"q13", FIRST_VFP_REGNUM + 52, 4}, \
136 {"q14", FIRST_VFP_REGNUM + 56, 4}, \
137 {"q15", FIRST_VFP_REGNUM + 60, 4} \
139 #endif
141 #ifndef NO_DOLLAR_IN_LABEL
142 #define NO_DOLLAR_IN_LABEL 1
143 #endif
145 /* Generate DBX debugging information. riscix.h will undefine this because
146 the native assembler does not support stabs. */
147 #define DBX_DEBUGGING_INFO 1
149 /* Acorn dbx moans about continuation chars, so don't use any. */
150 #ifndef DBX_CONTIN_LENGTH
151 #define DBX_CONTIN_LENGTH 0
152 #endif
154 /* Output a function label definition. */
155 #ifndef ASM_DECLARE_FUNCTION_NAME
156 #define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \
157 do \
159 ARM_DECLARE_FUNCTION_NAME (STREAM, NAME, DECL); \
160 ASM_OUTPUT_LABEL (STREAM, NAME); \
162 while (0)
163 #endif
165 /* Globalizing directive for a label. */
166 #define GLOBAL_ASM_OP "\t.global\t"
168 /* Make an internal label into a string. */
169 #ifndef ASM_GENERATE_INTERNAL_LABEL
170 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
171 sprintf (STRING, "*%s%s%u", LOCAL_LABEL_PREFIX, PREFIX, (unsigned int)(NUM))
172 #endif
174 /* Output an element of a dispatch table. */
175 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
176 do \
178 gcc_assert (!TARGET_THUMB2); \
179 asm_fprintf (STREAM, "\t.word\t%LL%d\n", VALUE); \
181 while (0)
184 /* Thumb-2 always uses addr_diff_elf so that the Table Branch instructions
185 can be used. For non-pic code where the offsets do not suitable for
186 TBB/TBH the elements are output as absolute labels. */
187 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
188 do \
190 if (TARGET_ARM) \
191 asm_fprintf (STREAM, "\tb\t%LL%d\n", VALUE); \
192 else if (TARGET_THUMB1) \
194 if (flag_pic || optimize_size) \
196 switch (GET_MODE(body)) \
198 case QImode: \
199 asm_fprintf (STREAM, "\t.byte\t(%LL%d-%LL%d)/2\n", \
200 VALUE, REL); \
201 break; \
202 case HImode: /* TBH */ \
203 asm_fprintf (STREAM, "\t.2byte\t(%LL%d-%LL%d)/2\n", \
204 VALUE, REL); \
205 break; \
206 case SImode: \
207 asm_fprintf (STREAM, "\t.word\t%LL%d-%LL%d\n", \
208 VALUE, REL); \
209 break; \
210 default: \
211 gcc_unreachable(); \
214 else \
215 asm_fprintf (STREAM, "\t.word\t%LL%d+1\n", VALUE); \
217 else /* Thumb-2 */ \
219 switch (GET_MODE(body)) \
221 case QImode: /* TBB */ \
222 asm_fprintf (STREAM, "\t.byte\t(%LL%d-%LL%d)/2\n", \
223 VALUE, REL); \
224 break; \
225 case HImode: /* TBH */ \
226 asm_fprintf (STREAM, "\t.2byte\t(%LL%d-%LL%d)/2\n", \
227 VALUE, REL); \
228 break; \
229 case SImode: \
230 if (flag_pic) \
231 asm_fprintf (STREAM, "\t.word\t%LL%d+1-%LL%d\n", VALUE, REL); \
232 else \
233 asm_fprintf (STREAM, "\t.word\t%LL%d+1\n", VALUE); \
234 break; \
235 default: \
236 gcc_unreachable(); \
240 while (0)
243 #undef ASM_OUTPUT_ASCII
244 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
245 output_ascii_pseudo_op (STREAM, (const unsigned char *) (PTR), LEN)
247 /* Output a gap. In fact we fill it with nulls. */
248 #undef ASM_OUTPUT_SKIP
249 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
250 fprintf (STREAM, "\t.space\t%d\n", (int) (NBYTES))
252 /* Align output to a power of two. Horrible /bin/as. */
253 #ifndef ASM_OUTPUT_ALIGN
254 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
255 do \
257 register int amount = 1 << (POWER); \
259 if (amount == 2) \
260 fprintf (STREAM, "\t.even\n"); \
261 else if (amount != 1) \
262 fprintf (STREAM, "\t.align\t%d\n", amount - 4); \
264 while (0)
265 #endif
267 /* Output a common block. */
268 #ifndef ASM_OUTPUT_COMMON
269 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
270 do \
272 fprintf (STREAM, "\t.comm\t"); \
273 assemble_name (STREAM, NAME); \
274 asm_fprintf (STREAM, ", %d\t%@ %d\n", \
275 (int)(ROUNDED), (int)(SIZE)); \
277 while (0)
278 #endif
280 /* Output a local common block. /bin/as can't do this, so hack a
281 `.space' into the bss segment. Note that this is *bad* practice,
282 which is guaranteed NOT to work since it doesn't define STATIC
283 COMMON space but merely STATIC BSS space. */
284 #ifndef ASM_OUTPUT_ALIGNED_LOCAL
285 #define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN) \
286 do \
288 switch_to_section (bss_section); \
289 ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
290 ASM_OUTPUT_LABEL (STREAM, NAME); \
291 fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE)); \
293 while (0)
294 #endif
296 /* Output a zero-initialized block. */
297 #ifndef ASM_OUTPUT_ALIGNED_BSS
298 #define ASM_OUTPUT_ALIGNED_BSS(STREAM, DECL, NAME, SIZE, ALIGN) \
299 asm_output_aligned_bss (STREAM, DECL, NAME, SIZE, ALIGN)
300 #endif
302 #ifndef ASM_COMMENT_START
303 #define ASM_COMMENT_START "@"
304 #endif
306 /* This works for GAS and some other assemblers. */
307 #define SET_ASM_OP "\t.set\t"