]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/arm/aof.h
1 /* Definitions of target machine for GNU compiler, for Advanced RISC Machines
2 ARM compilation, AOF Assembler.
3 Copyright (C) 1995, 1996, 1997, 2000, 2003, 2004, 2007
4 Free Software Foundation, Inc.
5 Contributed by Richard Earnshaw (rearnsha@armltd.co.uk)
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 3, or (at your
12 option) any later version.
14 GCC is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
27 #define LINK_LIBGCC_SPECIAL 1
29 #define LINK_SPEC "%{aof} %{bin} %{aif} %{ihf} %{shl,*} %{reent*} %{split} \
30 %{ov*} %{reloc*} -nodebug"
32 #define STARTFILE_SPEC "crtbegin.o%s"
34 #define ENDFILE_SPEC "crtend.o%s"
37 #define ASM_SPEC "%{g -g} -arch 4 -apcs 3/32bit"
41 #define LIB_SPEC "%{Eb: armlib_h.32b%s}%{!Eb: armlib_h.32l%s}"
44 #define LIBGCC_SPEC "libgcc.a%s"
46 #define CTOR_LIST_BEGIN \
47 asm (CTORS_SECTION_ASM_OP); \
48 extern func_ptr __CTOR_END__[1]; \
49 func_ptr __CTOR_LIST__[1] = {__CTOR_END__};
51 #define CTOR_LIST_END \
52 asm (CTORS_SECTION_ASM_OP); \
53 func_ptr __CTOR_END__[1] = { (func_ptr) 0 };
55 #define DO_GLOBAL_CTORS_BODY \
58 func_ptr *ptr = __CTOR_LIST__ + 1; \
65 #define DTOR_LIST_BEGIN \
66 asm (DTORS_SECTION_ASM_OP); \
67 extern func_ptr __DTOR_END__[1]; \
68 func_ptr __DTOR_LIST__[1] = {__DTOR_END__};
70 #define DTOR_LIST_END \
71 asm (DTORS_SECTION_ASM_OP); \
72 func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
74 #define DO_GLOBAL_DTORS_BODY \
77 func_ptr *ptr = __DTOR_LIST__ + 1; \
84 /* We really want to put Thumb tables in a read-only data section, but
85 switching to another section during function output is not
86 possible. We could however do what the SPARC does and defer the
87 whole table generation until the end of the function. */
88 #define JUMP_TABLES_IN_TEXT_SECTION 1
90 #define TARGET_ASM_INIT_SECTIONS aof_asm_init_sections
92 /* Some systems use __main in a way incompatible with its use in gcc, in these
93 cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
94 give the same symbol without quotes for an alternative entry point. You
95 must define both, or neither. */
96 #define NAME__MAIN "__gccmain"
97 #define SYMBOL__MAIN __gccmain
99 #define ASM_COMMENT_START ";"
100 #define ASM_APP_ON ""
101 #define ASM_APP_OFF ""
103 #define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \
106 const char *ptr = (PTR); \
107 fprintf ((STREAM), "\tDCB"); \
108 for (i = 0; i < (long)(LEN); i++) \
109 fprintf ((STREAM), " &%02x%s", \
110 (unsigned ) *(ptr++), \
111 (i + 1 < (long)(LEN) \
112 ? ((i & 3) == 3 ? "\n\tDCB" : ",") \
116 #define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n')
118 /* Output of Uninitialized Variables. */
120 #define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \
121 (in_section = NULL, \
122 fprintf ((STREAM), "\tAREA "), \
123 assemble_name ((STREAM), (NAME)), \
124 fprintf ((STREAM), ", DATA, COMMON\n\t%% %d\t%s size=%d\n", \
125 (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE)))
127 #define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \
128 (zero_init_section (), \
129 assemble_name ((STREAM), (NAME)), \
130 fprintf ((STREAM), "\n"), \
131 fprintf ((STREAM), "\t%% %d\t%s size=%d\n", \
132 (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE)))
134 /* Output and Generation of Labels */
135 extern int arm_main_function
;
137 /* Globalizing directive for a label. */
138 #define GLOBAL_ASM_OP "\tEXPORT\t"
140 #define ASM_OUTPUT_LABEL(STREAM,NAME) \
142 assemble_name (STREAM,NAME); \
143 fputs ("\n", STREAM); \
146 #define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \
148 if (TARGET_POKE_FUNCTION_NAME) \
149 arm_poke_function_name ((STREAM), (NAME)); \
150 ASM_OUTPUT_LABEL (STREAM, NAME); \
151 if (! TREE_PUBLIC (DECL)) \
153 fputs ("\tKEEP ", STREAM); \
154 ASM_OUTPUT_LABEL (STREAM, NAME); \
156 aof_delete_import ((NAME)); \
159 #define ASM_DECLARE_OBJECT_NAME(STREAM,NAME,DECL) \
161 ASM_OUTPUT_LABEL (STREAM, NAME); \
162 if (! TREE_PUBLIC (DECL)) \
164 fputs ("\tKEEP ", STREAM); \
165 ASM_OUTPUT_LABEL (STREAM, NAME); \
167 aof_delete_import ((NAME)); \
170 #define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \
171 aof_add_import ((NAME))
173 #define ASM_OUTPUT_EXTERNAL_LIBCALL(STREAM,SYMREF) \
174 (fprintf ((STREAM), "\tIMPORT\t"), \
175 assemble_name ((STREAM), XSTR ((SYMREF), 0)), \
176 fputc ('\n', (STREAM)))
178 #define ASM_OUTPUT_LABELREF(STREAM,NAME) \
179 fprintf ((STREAM), "|%s|", NAME)
181 #define ASM_GENERATE_INTERNAL_LABEL(STRING,PREFIX,NUM) \
182 sprintf ((STRING), "*|%s..%ld|", (PREFIX), (long)(NUM))
184 /* How initialization functions are handled. */
186 #define CTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_ctorsvec|, DATA, READONLY"
187 #define DTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_dtorsvec|, DATA, READONLY"
189 /* Output of Assembler Instructions. Note that the ?xx registers are
190 there so that VFPv3/NEON registers D16-D31 have the same spacing as D0-D15
191 (each of which is overlaid on two S registers), although there are no
192 actual single-precision registers which correspond to D16-D31. */
194 #define REGISTER_NAMES \
196 "a1", "a2", "a3", "a4", \
197 "v1", "v2", "v3", "v4", \
198 "v5", "v6", "sl", "fp", \
199 "ip", "sp", "lr", "pc", \
200 "f0", "f1", "f2", "f3", \
201 "f4", "f5", "f6", "f7", \
202 "cc", "sfp", "afp", \
203 "mv0", "mv1", "mv2", "mv3", \
204 "mv4", "mv5", "mv6", "mv7", \
205 "mv8", "mv9", "mv10", "mv11", \
206 "mv12", "mv13", "mv14", "mv15", \
207 "wcgr0", "wcgr1", "wcgr2", "wcgr3", \
208 "wr0", "wr1", "wr2", "wr3", \
209 "wr4", "wr5", "wr6", "wr7", \
210 "wr8", "wr9", "wr10", "wr11", \
211 "wr12", "wr13", "wr14", "wr15", \
212 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \
213 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", \
214 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", \
215 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", \
216 "d16", "?16", "d17", "?17", "d18", "?18", "d19", "?19", \
217 "d20", "?20", "d21", "?21", "d22", "?22", "d23", "?23", \
218 "d24", "?24", "d25", "?25", "d26", "?26", "d27", "?27", \
219 "d28", "?28", "d29", "?29", "d30", "?30", "d31", "?31", \
223 #define ADDITIONAL_REGISTER_NAMES \
225 {"r0", 0}, {"a1", 0}, \
226 {"r1", 1}, {"a2", 1}, \
227 {"r2", 2}, {"a3", 2}, \
228 {"r3", 3}, {"a4", 3}, \
229 {"r4", 4}, {"v1", 4}, \
230 {"r5", 5}, {"v2", 5}, \
231 {"r6", 6}, {"v3", 6}, \
232 {"r7", 7}, {"wr", 7}, \
233 {"r8", 8}, {"v5", 8}, \
234 {"r9", 9}, {"v6", 9}, \
235 {"r10", 10}, {"sl", 10}, {"v7", 10}, \
236 {"r11", 11}, {"fp", 11}, \
237 {"r12", 12}, {"ip", 12}, \
238 {"r13", 13}, {"sp", 13}, \
239 {"r14", 14}, {"lr", 14}, \
240 {"r15", 15}, {"pc", 15}, \
241 {"d0", 63}, {"q0", 63}, \
243 {"d2", 67}, {"q1", 67}, \
245 {"d4", 71}, {"q2", 71}, \
247 {"d6", 75}, {"q3", 75}, \
249 {"d8", 79}, {"q4", 79}, \
251 {"d10", 83}, {"q5", 83}, \
253 {"d12", 87}, {"q6", 87}, \
255 {"d14", 91}, {"q7", 91}, \
267 #define REGISTER_PREFIX "__"
268 #define USER_LABEL_PREFIX ""
269 #define LOCAL_LABEL_PREFIX ""
271 /* AOF does not prefix user function names with an underscore. */
272 #define ARM_MCOUNT_NAME "_mcount"
274 /* Output of Dispatch Tables. */
275 #define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \
279 fprintf ((STREAM), "\tb\t|L..%d|\n", (VALUE)); \
280 else if (TARGET_THUMB1) \
281 fprintf ((STREAM), "\tDCD\t|L..%d| - |L..%d|\n", (VALUE), (REL)); \
284 switch (GET_MODE(body)) \
286 case QImode: /* TBB */ \
287 asm_fprintf (STREAM, "\tDCB\t(|L..%d| - |L..%d|)/2\n", \
290 case HImode: /* TBH */ \
291 asm_fprintf (STREAM, "\tDCW\t|L..%d| - |L..%d|)/2\n", \
296 asm_fprintf (STREAM, "\tDCD\t|L..%d| + 1 - |L..%d|\n", \
299 asm_fprintf (STREAM, "\tDCD\t|L..%d| + 1\n", VALUE); \
308 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \
311 gcc_assert (!TARGET_THUMB2) \
312 fprintf ((STREAM), "\tDCD\t|L..%d|\n", (VALUE)) \
317 /* A label marking the start of a jump table is a data label. */
318 #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \
319 fprintf ((STREAM), "\tALIGN\n|%s..%d|\n", (PREFIX), (NUM))
321 /* Assembler Commands for Alignment. */
322 #define ASM_OUTPUT_SKIP(STREAM, NBYTES) \
323 fprintf ((STREAM), "\t%%\t%d\n", (int) (NBYTES))
325 #define ASM_OUTPUT_ALIGN(STREAM, POWER) \
328 int amount = 1 << (POWER); \
331 fprintf ((STREAM), "\tALIGN 2\n"); \
332 else if (amount == 4) \
333 fprintf ((STREAM), "\tALIGN\n"); \
335 fprintf ((STREAM), "\tALIGN %d\n", amount); \
339 #undef DBX_DEBUGGING_INFO