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