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