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 4 Free Software Foundation, Inc. 5 Contributed by Richard Earnshaw (rearnsha@armltd.co.uk) 6 7 This file is part of GCC. 8 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 2, or (at your 12 option) any later version. 13 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. 18 19 You should have received a copy of the GNU General Public License 20 along with GCC; see the file COPYING. If not, write to 21 the Free Software Foundation, 51 Franklin Street, Fifth Floor, 22 Boston, MA 02110-1301, USA. */ 23 24 25 26#define AOF_ASSEMBLER 27 28#define LINK_LIBGCC_SPECIAL 1 29 30#define LINK_SPEC "%{aof} %{bin} %{aif} %{ihf} %{shl,*} %{reent*} %{split} \ 31 %{ov*} %{reloc*} -nodebug" 32 33#define STARTFILE_SPEC "crtbegin.o%s" 34 35#define ENDFILE_SPEC "crtend.o%s" 36 37#ifndef ASM_SPEC 38#define ASM_SPEC "%{g -g} -arch 4 -apcs 3/32bit" 39#endif 40 41#ifndef LIB_SPEC 42#define LIB_SPEC "%{Eb: armlib_h.32b%s}%{!Eb: armlib_h.32l%s}" 43#endif 44 45#define LIBGCC_SPEC "libgcc.a%s" 46 47#define CTOR_LIST_BEGIN \ 48 asm (CTORS_SECTION_ASM_OP); \ 49 extern func_ptr __CTOR_END__[1]; \ 50 func_ptr __CTOR_LIST__[1] = {__CTOR_END__}; 51 52#define CTOR_LIST_END \ 53 asm (CTORS_SECTION_ASM_OP); \ 54 func_ptr __CTOR_END__[1] = { (func_ptr) 0 }; 55 56#define DO_GLOBAL_CTORS_BODY \ 57 do \ 58 { \ 59 func_ptr *ptr = __CTOR_LIST__ + 1; \ 60 \ 61 while (*ptr) \ 62 (*ptr++) (); \ 63 } \ 64 while (0) 65 66#define DTOR_LIST_BEGIN \ 67 asm (DTORS_SECTION_ASM_OP); \ 68 extern func_ptr __DTOR_END__[1]; \ 69 func_ptr __DTOR_LIST__[1] = {__DTOR_END__}; 70 71#define DTOR_LIST_END \ 72 asm (DTORS_SECTION_ASM_OP); \ 73 func_ptr __DTOR_END__[1] = { (func_ptr) 0 }; 74 75#define DO_GLOBAL_DTORS_BODY \ 76 do \ 77 { \ 78 func_ptr *ptr = __DTOR_LIST__ + 1; \ 79 \ 80 while (*ptr) \ 81 (*ptr++) (); \ 82 } \ 83 while (0) 84 85/* We really want to put Thumb tables in a read-only data section, but 86 switching to another section during function output is not 87 possible. We could however do what the SPARC does and defer the 88 whole table generation until the end of the function. */ 89#define JUMP_TABLES_IN_TEXT_SECTION 1 90 91#define TARGET_ASM_INIT_SECTIONS aof_asm_init_sections 92 93/* Some systems use __main in a way incompatible with its use in gcc, in these 94 cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to 95 give the same symbol without quotes for an alternative entry point. You 96 must define both, or neither. */ 97#define NAME__MAIN "__gccmain" 98#define SYMBOL__MAIN __gccmain 99 100#define ASM_COMMENT_START ";" 101#define ASM_APP_ON "" 102#define ASM_APP_OFF "" 103 104#define ASM_OUTPUT_ASCII(STREAM, PTR, LEN) \ 105{ \ 106 int i; \ 107 const char *ptr = (PTR); \ 108 fprintf ((STREAM), "\tDCB"); \ 109 for (i = 0; i < (long)(LEN); i++) \ 110 fprintf ((STREAM), " &%02x%s", \ 111 (unsigned ) *(ptr++), \ 112 (i + 1 < (long)(LEN) \ 113 ? ((i & 3) == 3 ? "\n\tDCB" : ",") \ 114 : "\n")); \ 115} 116 117#define IS_ASM_LOGICAL_LINE_SEPARATOR(C) ((C) == '\n') 118 119/* Output of Uninitialized Variables. */ 120 121#define ASM_OUTPUT_COMMON(STREAM, NAME, SIZE, ROUNDED) \ 122 (in_section = NULL, \ 123 fprintf ((STREAM), "\tAREA "), \ 124 assemble_name ((STREAM), (NAME)), \ 125 fprintf ((STREAM), ", DATA, COMMON\n\t%% %d\t%s size=%d\n", \ 126 (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE))) 127 128#define ASM_OUTPUT_LOCAL(STREAM, NAME, SIZE, ROUNDED) \ 129 (zero_init_section (), \ 130 assemble_name ((STREAM), (NAME)), \ 131 fprintf ((STREAM), "\n"), \ 132 fprintf ((STREAM), "\t%% %d\t%s size=%d\n", \ 133 (int)(ROUNDED), ASM_COMMENT_START, (int)(SIZE))) 134 135/* Output and Generation of Labels */ 136extern int arm_main_function; 137 138/* Globalizing directive for a label. */ 139#define GLOBAL_ASM_OP "\tEXPORT\t" 140 141#define ASM_OUTPUT_LABEL(STREAM,NAME) \ 142do { \ 143 assemble_name (STREAM,NAME); \ 144 fputs ("\n", STREAM); \ 145} while (0) 146 147#define ASM_DECLARE_FUNCTION_NAME(STREAM,NAME,DECL) \ 148{ \ 149 if (TARGET_POKE_FUNCTION_NAME) \ 150 arm_poke_function_name ((STREAM), (NAME)); \ 151 ASM_OUTPUT_LABEL (STREAM, NAME); \ 152 if (! TREE_PUBLIC (DECL)) \ 153 { \ 154 fputs ("\tKEEP ", STREAM); \ 155 ASM_OUTPUT_LABEL (STREAM, NAME); \ 156 } \ 157 aof_delete_import ((NAME)); \ 158} 159 160#define ASM_DECLARE_OBJECT_NAME(STREAM,NAME,DECL) \ 161{ \ 162 ASM_OUTPUT_LABEL (STREAM, NAME); \ 163 if (! TREE_PUBLIC (DECL)) \ 164 { \ 165 fputs ("\tKEEP ", STREAM); \ 166 ASM_OUTPUT_LABEL (STREAM, NAME); \ 167 } \ 168 aof_delete_import ((NAME)); \ 169} 170 171#define ASM_OUTPUT_EXTERNAL(STREAM,DECL,NAME) \ 172 aof_add_import ((NAME)) 173 174#define ASM_OUTPUT_EXTERNAL_LIBCALL(STREAM,SYMREF) \ 175 (fprintf ((STREAM), "\tIMPORT\t"), \ 176 assemble_name ((STREAM), XSTR ((SYMREF), 0)), \ 177 fputc ('\n', (STREAM))) 178 179#define ASM_OUTPUT_LABELREF(STREAM,NAME) \ 180 fprintf ((STREAM), "|%s|", NAME) 181 182#define ASM_GENERATE_INTERNAL_LABEL(STRING,PREFIX,NUM) \ 183 sprintf ((STRING), "*|%s..%ld|", (PREFIX), (long)(NUM)) 184 185/* How initialization functions are handled. */ 186 187#define CTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_ctorsvec|, DATA, READONLY" 188#define DTORS_SECTION_ASM_OP "\tAREA\t|C$$gnu_dtorsvec|, DATA, READONLY" 189 190/* Output of Assembler Instructions. */ 191 192#define REGISTER_NAMES \ 193{ \ 194 "a1", "a2", "a3", "a4", \ 195 "v1", "v2", "v3", "v4", \ 196 "v5", "v6", "sl", "fp", \ 197 "ip", "sp", "lr", "pc", \ 198 "f0", "f1", "f2", "f3", \ 199 "f4", "f5", "f6", "f7", \ 200 "cc", "sfp", "afp", \ 201 "mv0", "mv1", "mv2", "mv3", \ 202 "mv4", "mv5", "mv6", "mv7", \ 203 "mv8", "mv9", "mv10", "mv11", \ 204 "mv12", "mv13", "mv14", "mv15", \ 205 "wcgr0", "wcgr1", "wcgr2", "wcgr3", \ 206 "wr0", "wr1", "wr2", "wr3", \ 207 "wr4", "wr5", "wr6", "wr7", \ 208 "wr8", "wr9", "wr10", "wr11", \ 209 "wr12", "wr13", "wr14", "wr15", \ 210 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", \ 211 "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", \ 212 "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", \ 213 "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", \ 214 "vfpcc" \ 215} 216 217#define ADDITIONAL_REGISTER_NAMES \ 218{ \ 219 {"r0", 0}, {"a1", 0}, \ 220 {"r1", 1}, {"a2", 1}, \ 221 {"r2", 2}, {"a3", 2}, \ 222 {"r3", 3}, {"a4", 3}, \ 223 {"r4", 4}, {"v1", 4}, \ 224 {"r5", 5}, {"v2", 5}, \ 225 {"r6", 6}, {"v3", 6}, \ 226 {"r7", 7}, {"wr", 7}, \ 227 {"r8", 8}, {"v5", 8}, \ 228 {"r9", 9}, {"v6", 9}, \ 229 {"r10", 10}, {"sl", 10}, {"v7", 10}, \ 230 {"r11", 11}, {"fp", 11}, \ 231 {"r12", 12}, {"ip", 12}, \ 232 {"r13", 13}, {"sp", 13}, \ 233 {"r14", 14}, {"lr", 14}, \ 234 {"r15", 15}, {"pc", 15}, \ 235 {"d0", 63}, \ 236 {"d1", 65}, \ 237 {"d2", 67}, \ 238 {"d3", 69}, \ 239 {"d4", 71}, \ 240 {"d5", 73}, \ 241 {"d6", 75}, \ 242 {"d7", 77}, \ 243 {"d8", 79}, \ 244 {"d9", 81}, \ 245 {"d10", 83}, \ 246 {"d11", 85}, \ 247 {"d12", 87}, \ 248 {"d13", 89}, \ 249 {"d14", 91}, \ 250 {"d15", 93} \ 251} 252 253#define REGISTER_PREFIX "__" 254#define USER_LABEL_PREFIX "" 255#define LOCAL_LABEL_PREFIX "" 256 257/* AOF does not prefix user function names with an underscore. */ 258#define ARM_MCOUNT_NAME "_mcount" 259 260/* Output of Dispatch Tables. */ 261#define ASM_OUTPUT_ADDR_DIFF_ELT(STREAM, BODY, VALUE, REL) \ 262 do \ 263 { \ 264 if (TARGET_ARM) \ 265 fprintf ((STREAM), "\tb\t|L..%d|\n", (VALUE)); \ 266 else \ 267 fprintf ((STREAM), "\tDCD\t|L..%d| - |L..%d|\n", (VALUE), (REL)); \ 268 } \ 269 while (0) 270 271#define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE) \ 272 fprintf ((STREAM), "\tDCD\t|L..%d|\n", (VALUE)) 273 274/* A label marking the start of a jump table is a data label. */ 275#define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE) \ 276 fprintf ((STREAM), "\tALIGN\n|%s..%d|\n", (PREFIX), (NUM)) 277 278/* Assembler Commands for Alignment. */ 279#define ASM_OUTPUT_SKIP(STREAM, NBYTES) \ 280 fprintf ((STREAM), "\t%%\t%d\n", (int) (NBYTES)) 281 282#define ASM_OUTPUT_ALIGN(STREAM, POWER) \ 283 do \ 284 { \ 285 int amount = 1 << (POWER); \ 286 \ 287 if (amount == 2) \ 288 fprintf ((STREAM), "\tALIGN 2\n"); \ 289 else if (amount == 4) \ 290 fprintf ((STREAM), "\tALIGN\n"); \ 291 else \ 292 fprintf ((STREAM), "\tALIGN %d\n", amount); \ 293 } \ 294 while (0) 295 296#undef DBX_DEBUGGING_INFO 297