1 /* m68kelf support, derived from m68kv4.h */ 2 3 /* Target definitions for GNU compiler for mc680x0 running System V.4 4 Copyright (C) 1991, 1993, 2000, 2002 Free Software Foundation, Inc. 5 6 Written by Ron Guilmette (rfg@netcom.com) and Fred Fish (fnf@cygnus.com). 7 8 This file is part of GNU CC. 9 10 GNU CC is free software; you can redistribute it and/or modify 11 it under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 2, or (at your option) 13 any later version. 14 15 GNU CC is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with GNU CC; see the file COPYING. If not, write to 22 the Free Software Foundation, 59 Temple Place - Suite 330, 23 Boston, MA 02111-1307, USA. */ 24 25 /* #notinclude "m68k/sgs.h" / * The m68k/SVR4 assembler is SGS based */ 26 27 /* These are necessary for -fpic/-fPIC to work correctly. */ 28 #ifndef MOTOROLA 29 #define MOTOROLA /* Use MOTOROLA syntax. */ 30 #endif 31 #ifndef USE_GAS /* forces jsbr instead of jsr. */ 32 #define USE_GAS 33 #endif 34 35 #ifndef SWBEG_ASM_OP 36 #define SWBEG_ASM_OP "\t.swbeg\t" 37 #endif 38 39 /* Here are four prefixes that are used by asm_fprintf to 40 facilitate customization for alternate assembler syntaxes. 41 Machines with no likelihood of an alternate syntax need not 42 define these and need not use asm_fprintf. */ 43 44 /* The prefix for register names. Note that REGISTER_NAMES 45 is supposed to include this prefix. Also note that this is NOT an 46 fprintf format string, it is a literal string */ 47 48 #undef REGISTER_PREFIX 49 #define REGISTER_PREFIX "%" 50 51 /* The prefix for local (compiler generated) labels. 52 These labels will not appear in the symbol table. */ 53 54 #undef LOCAL_LABEL_PREFIX 55 #define LOCAL_LABEL_PREFIX "." 56 57 /* The prefix to add to user-visible assembler symbols. */ 58 59 #undef USER_LABEL_PREFIX 60 #define USER_LABEL_PREFIX "" 61 62 /* The prefix for immediate operands. */ 63 64 #undef IMMEDIATE_PREFIX 65 #define IMMEDIATE_PREFIX "#" 66 67 /* In the machine description we can't use %R, because it will not be seen 68 by ASM_FPRINTF. (Isn't that a design bug?). */ 69 70 #undef REGISTER_PREFIX_MD 71 #define REGISTER_PREFIX_MD "%%" 72 73 /* config/m68k.md has an explicit reference to the program counter, 74 prefix this by the register prefix. */ 75 76 #define ASM_RETURN_CASE_JUMP \ 77 do { \ 78 if (TARGET_5200) \ 79 { \ 80 if (ADDRESS_REG_P (operands[0])) \ 81 return "jmp %%pc@(2,%0:l)"; \ 82 else \ 83 return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \ 84 } \ 85 else \ 86 return "jmp %%pc@(2,%0:w)"; \ 87 } while (0) 88 89 /* How to refer to registers in assembler output. 90 This sequence is indexed by compiler's hard-register-number. 91 Motorola format uses different register names than defined 92 in m68k.h. */ 93 94 #undef REGISTER_NAMES 95 96 #define REGISTER_NAMES \ 97 {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \ 98 "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \ 99 "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" } 100 101 /* This is how to output an assembler line that says to advance the 102 location counter to a multiple of 2**LOG bytes. */ 103 104 #undef ASM_OUTPUT_ALIGN 105 #define ASM_OUTPUT_ALIGN(FILE,LOG) \ 106 do { \ 107 if ((LOG) > 0) \ 108 fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); \ 109 else if ((LOG) > 31) \ 110 abort (); \ 111 } while (0) 112 113 /* Use proper assembler syntax for these macros. */ 114 #undef ASM_OUTPUT_REG_PUSH 115 #define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \ 116 asm_fprintf (FILE, "\t%Omove.l %s,-(%Rsp)\n", reg_names[REGNO]) 117 118 #undef ASM_OUTPUT_REG_POP 119 #define ASM_OUTPUT_REG_POP(FILE,REGNO) \ 120 asm_fprintf (FILE, "\t%Omove.l (%Rsp)+,%s\n", reg_names[REGNO]) 121 122 /* Override the definition of NO_DOLLAR_IN_LABEL in svr4.h, for special 123 g++ assembler names. When this is defined, g++ uses embedded '.' 124 characters and some m68k assemblers have problems with this. The 125 chances are much greater that any particular assembler will permit 126 embedded '$' characters. */ 127 128 #undef NO_DOLLAR_IN_LABEL 129 130 /* Define PCC_STATIC_STRUCT_RETURN if the convention on the target machine 131 is to use the nonreentrant technique for returning structure and union 132 values, as commonly implemented by the AT&T Portable C Compiler (PCC). 133 When defined, the gcc option -fpcc-struct-return can be used to cause 134 this form to be generated. When undefined, the option does nothing. 135 For m68k SVR4, the convention is to use a reentrant technique compatible 136 with the gcc default, so override the definition of this macro in m68k.h */ 137 138 #undef PCC_STATIC_STRUCT_RETURN 139 140 /* Local common symbols are declared to the assembler with ".lcomm" rather 141 than ".bss", so override the definition in svr4.h */ 142 143 #undef BSS_ASM_OP 144 #define BSS_ASM_OP "\t.lcomm\t" 145 146 /* Register in which address to store a structure value is passed to a 147 function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */ 148 149 #undef STRUCT_VALUE_REGNUM 150 #define STRUCT_VALUE_REGNUM 8 151 152 #define ASM_COMMENT_START "|" 153 154 /* Define how the m68k registers should be numbered for Dwarf output. 155 The numbering provided here should be compatible with the native 156 SVR4 SDB debugger in the m68k/SVR4 reference port, where d0-d7 157 are 0-7, a0-a8 are 8-15, and fp0-fp7 are 16-23. */ 158 159 #undef DBX_REGISTER_NUMBER 160 #define DBX_REGISTER_NUMBER(REGNO) (REGNO) 161 162 /* The ASM_OUTPUT_SKIP macro is first defined in m68k.h, using ".skip". 163 It is then overridden by m68k/sgs.h to use ".space", and again by svr4.h 164 to use ".zero". The m68k/SVR4 assembler uses ".space", so repeat the 165 definition from m68k/sgs.h here. Note that ASM_NO_SKIP_IN_TEXT is 166 defined in m68k/sgs.h, so we don't have to repeat it here. */ 167 168 #undef ASM_OUTPUT_SKIP 169 #define ASM_OUTPUT_SKIP(FILE,SIZE) \ 170 fprintf (FILE, "%s%u\n", SPACE_ASM_OP, (SIZE)) 171 172 #if 0 173 /* SVR4 m68k assembler is bitching on the `comm i,1,1' which askes for 174 1 byte alignment. Don't generate alignment for COMMON seems to be 175 safer until we the assembler is fixed. */ 176 #undef ASM_OUTPUT_ALIGNED_COMMON 177 /* Same problem with this one. */ 178 #undef ASM_OUTPUT_ALIGNED_LOCAL 179 #endif 180 181 /* The `string' directive on m68k svr4 does not handle string with 182 escape char (ie., `\') right. Use normal way to output ASCII bytes 183 seems to be safer. */ 184 #undef ASM_OUTPUT_ASCII 185 #define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \ 186 do { \ 187 register int sp = 0, ch; \ 188 fputs (integer_asm_op (1, TRUE), (FILE)); \ 189 do { \ 190 ch = (PTR)[sp]; \ 191 if (ch > ' ' && ! (ch & 0x80) && ch != '\\') \ 192 { \ 193 fprintf ((FILE), "'%c", ch); \ 194 } \ 195 else \ 196 { \ 197 fprintf ((FILE), "0x%x", ch); \ 198 } \ 199 if (++sp < (LEN)) \ 200 { \ 201 if ((sp % 10) == 0) \ 202 { \ 203 fprintf ((FILE), "\n%s", integer_asm_op (1, TRUE)); \ 204 } \ 205 else \ 206 { \ 207 putc (',', (FILE)); \ 208 } \ 209 } \ 210 } while (sp < (LEN)); \ 211 putc ('\n', (FILE)); \ 212 } while (0) 213 214 /* SVR4 m68k assembler is bitching on the syntax `2.b'. 215 So use the "LLDnnn-LLnnn" format. Define LLDnnn after the table. */ 216 217 #undef ASM_OUTPUT_CASE_END 218 #define ASM_OUTPUT_CASE_END(FILE,NUM,TABLE) \ 219 do { \ 220 if (switch_table_difference_label_flag) \ 221 asm_fprintf ((FILE), "%s%LLD%d,%LL%d\n", SET_ASM_OP, (NUM), (NUM)); \ 222 switch_table_difference_label_flag = 0; \ 223 } while (0) 224 225 extern int switch_table_difference_label_flag; 226 227 #undef ASM_OUTPUT_COMMON 228 #undef ASM_OUTPUT_LOCAL 229 #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ 230 ( fputs (".comm ", (FILE)), \ 231 assemble_name ((FILE), (NAME)), \ 232 fprintf ((FILE), ",%u\n", (SIZE))) 233 234 #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ 235 ( fputs (".lcomm ", (FILE)), \ 236 assemble_name ((FILE), (NAME)), \ 237 fprintf ((FILE), ",%u\n", (SIZE))) 238 239 /* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to 240 keep switch tables in the text section. */ 241 242 #define JUMP_TABLES_IN_TEXT_SECTION 1 243 244 /* Override the definition in svr4.h. In m68k svr4, using swbeg is the 245 standard way to do switch table. */ 246 #undef ASM_OUTPUT_BEFORE_CASE_LABEL 247 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \ 248 fprintf ((FILE), "%s&%d\n", SWBEG_ASM_OP, XVECLEN (PATTERN (TABLE), 1)); 249 /* end of stuff from m68kv4.h */ 250 251 #undef SGS_CMP_ORDER 252 253 #undef ENDFILE_SPEC 254 #define ENDFILE_SPEC "crtend.o%s" 255 256 #undef STARTFILE_SPEC 257 #define STARTFILE_SPEC "crtbegin.o%s" 258 259 /* If defined, a C expression whose value is a string containing the 260 assembler operation to identify the following data as 261 uninitialized global data. If not defined, and neither 262 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined, 263 uninitialized global data will be output in the data section if 264 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be 265 used. */ 266 #ifndef BSS_SECTION_ASM_OP 267 #define BSS_SECTION_ASM_OP "\t.section\t.bss" 268 #endif 269 270 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a 271 separate, explicit argument. If you define this macro, it is used 272 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in 273 handling the required alignment of the variable. The alignment is 274 specified as the number of bits. 275 276 Try to use function `asm_output_aligned_bss' defined in file 277 `varasm.c' when defining this macro. */ 278 #ifndef ASM_OUTPUT_ALIGNED_BSS 279 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 280 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) 281 #endif 282