1 |
709 |
jeremybenn |
/* Definitions of target machine for GNU compiler,
|
2 |
|
|
for m68k (including m68010) NetBSD platforms using the
|
3 |
|
|
ELF object format.
|
4 |
|
|
Copyright (C) 2002, 2003, 2004, 2006, 2007, 2009, 2010, 2011
|
5 |
|
|
Free Software Foundation, Inc.
|
6 |
|
|
Contributed by Wasabi Systems. Inc.
|
7 |
|
|
|
8 |
|
|
This file is derived from <m68k/m68kv4.h>, <m68k/m68kelf.h>,
|
9 |
|
|
and <m68k/linux.h>.
|
10 |
|
|
|
11 |
|
|
This file is part of GCC.
|
12 |
|
|
|
13 |
|
|
GCC is free software; you can redistribute it and/or modify
|
14 |
|
|
it under the terms of the GNU General Public License as published by
|
15 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
16 |
|
|
any later version.
|
17 |
|
|
|
18 |
|
|
GCC is distributed in the hope that it will be useful,
|
19 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
|
|
GNU General Public License for more details.
|
22 |
|
|
|
23 |
|
|
You should have received a copy of the GNU General Public License
|
24 |
|
|
along with GCC; see the file COPYING3. If not see
|
25 |
|
|
<http://www.gnu.org/licenses/>. */
|
26 |
|
|
|
27 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
28 |
|
|
do \
|
29 |
|
|
{ \
|
30 |
|
|
NETBSD_OS_CPP_BUILTINS_ELF(); \
|
31 |
|
|
builtin_define ("__m68k__"); \
|
32 |
|
|
builtin_define ("__SVR4_ABI__"); \
|
33 |
|
|
builtin_define ("__motorola__"); \
|
34 |
|
|
if (TARGET_HARD_FLOAT) \
|
35 |
|
|
builtin_define ("__HAVE_FPU__"); \
|
36 |
|
|
} \
|
37 |
|
|
while (0)
|
38 |
|
|
|
39 |
|
|
/* Don't try using XFmode on the 68010. */
|
40 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
41 |
|
|
#define LONG_DOUBLE_TYPE_SIZE (TARGET_68020 ? 80 : 64)
|
42 |
|
|
|
43 |
|
|
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
|
44 |
|
|
#ifdef __mc68010__
|
45 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
46 |
|
|
#else
|
47 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 80
|
48 |
|
|
#endif
|
49 |
|
|
|
50 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
51 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
52 |
|
|
{ "netbsd_entry_point", NETBSD_ENTRY_POINT },
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
/* Provide a CPP_SPEC appropriate for NetBSD m68k targets. Currently we
|
56 |
|
|
deal with the GCC option '-posix', as well as an indication as to
|
57 |
|
|
whether or not use of the FPU is allowed. */
|
58 |
|
|
|
59 |
|
|
#undef CPP_SPEC
|
60 |
|
|
#define CPP_SPEC NETBSD_CPP_SPEC
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
/* Provide an ASM_SPEC appropriate for NetBSD m68k ELF targets. We need
|
64 |
|
|
to pass PIC code generation options. */
|
65 |
|
|
|
66 |
|
|
#undef ASM_SPEC
|
67 |
|
|
#define ASM_SPEC "%(asm_cpu_spec) %{fpic|fpie:-k} %{fPIC|fPIE:-k -K}"
|
68 |
|
|
|
69 |
|
|
/* Provide a LINK_SPEC appropriate for a NetBSD/m68k ELF target. */
|
70 |
|
|
|
71 |
|
|
#undef LINK_SPEC
|
72 |
|
|
#define LINK_SPEC NETBSD_LINK_SPEC_ELF
|
73 |
|
|
|
74 |
|
|
#define NETBSD_ENTRY_POINT "_start"
|
75 |
|
|
|
76 |
|
|
/* Output assembler code to FILE to increment profiler label # LABELNO
|
77 |
|
|
for profiling a function only. */
|
78 |
|
|
|
79 |
|
|
#undef FUNCTION_PROFILER
|
80 |
|
|
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
81 |
|
|
do \
|
82 |
|
|
{ \
|
83 |
|
|
asm_fprintf (FILE, "\tlea (%LLP%d,%Rpc),%Ra1\n", (LABELNO)); \
|
84 |
|
|
if (flag_pic) \
|
85 |
|
|
fprintf (FILE, "\tbsr.l __mcount@PLTPC\n"); \
|
86 |
|
|
else \
|
87 |
|
|
fprintf (FILE, "\tjbsr __mcount\n"); \
|
88 |
|
|
} \
|
89 |
|
|
while (0)
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
/* Make gcc agree with <machine/ansi.h> */
|
93 |
|
|
|
94 |
|
|
#undef SIZE_TYPE
|
95 |
|
|
#define SIZE_TYPE "unsigned int"
|
96 |
|
|
|
97 |
|
|
#undef PTRDIFF_TYPE
|
98 |
|
|
#define PTRDIFF_TYPE "int"
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
/* XXX
|
102 |
|
|
Here is a bunch of stuff lifted from m68kelf.h. We don't use that
|
103 |
|
|
file directly, because it has a lot of baggage we don't want. */
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
/* The prefix for register names. Note that REGISTER_NAMES
|
107 |
|
|
is supposed to include this prefix. Also note that this is NOT an
|
108 |
|
|
fprintf format string, it is a literal string. */
|
109 |
|
|
|
110 |
|
|
#undef REGISTER_PREFIX
|
111 |
|
|
#define REGISTER_PREFIX "%"
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
/* The prefix for local (compiler generated) lables.
|
115 |
|
|
These labels will not appear in the symbol table. */
|
116 |
|
|
|
117 |
|
|
#undef LOCAL_LABEL_PREFIX
|
118 |
|
|
#define LOCAL_LABEL_PREFIX "."
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
/* The prefix to add to user-visible assembler symbols. */
|
122 |
|
|
|
123 |
|
|
#undef USER_LABEL_PREFIX
|
124 |
|
|
#define USER_LABEL_PREFIX ""
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
#undef ASM_COMMENT_START
|
128 |
|
|
#define ASM_COMMENT_START "|"
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
/* Currently, JUMP_TABLES_IN_TEXT_SECTION must be defined in order to
|
132 |
|
|
keep switch tables in the text section. */
|
133 |
|
|
|
134 |
|
|
#undef JUMP_TABLES_IN_TEXT_SECTION
|
135 |
|
|
#define JUMP_TABLES_IN_TEXT_SECTION 1
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
/* Use the default action for outputting the case label. */
|
139 |
|
|
#undef ASM_OUTPUT_CASE_LABEL
|
140 |
|
|
#define ASM_RETURN_CASE_JUMP \
|
141 |
|
|
do { \
|
142 |
|
|
if (TARGET_COLDFIRE) \
|
143 |
|
|
{ \
|
144 |
|
|
if (ADDRESS_REG_P (operands[0])) \
|
145 |
|
|
return "jmp %%pc@(2,%0:l)"; \
|
146 |
|
|
else \
|
147 |
|
|
return "ext%.l %0\n\tjmp %%pc@(2,%0:l)"; \
|
148 |
|
|
} \
|
149 |
|
|
else \
|
150 |
|
|
return "jmp %%pc@(2,%0:w)"; \
|
151 |
|
|
} while (0)
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
/* This is how to output an assembler line that says to advance the
|
155 |
|
|
location counter to a multiple of 2**LOG bytes. */
|
156 |
|
|
|
157 |
|
|
#undef ASM_OUTPUT_ALIGN
|
158 |
|
|
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
159 |
|
|
do \
|
160 |
|
|
{ \
|
161 |
|
|
if ((LOG) > 0) \
|
162 |
|
|
fprintf ((FILE), "%s%u\n", ALIGN_ASM_OP, 1 << (LOG)); \
|
163 |
|
|
} \
|
164 |
|
|
while (0)
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
/* If defined, a C expression whose value is a string containing the
|
168 |
|
|
assembler operation to identify the following data as uninitialized global
|
169 |
|
|
data. */
|
170 |
|
|
|
171 |
|
|
#define BSS_SECTION_ASM_OP ".section\t.bss"
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
#undef ASM_OUTPUT_ALIGNED_BSS
|
175 |
|
|
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
|
176 |
|
|
asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
#undef ASM_OUTPUT_COMMON
|
180 |
|
|
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
|
181 |
|
|
( fputs (".comm ", (FILE)), \
|
182 |
|
|
assemble_name ((FILE), (NAME)), \
|
183 |
|
|
fprintf ((FILE), ",%u\n", (int)(SIZE)))
|
184 |
|
|
|
185 |
|
|
#undef ASM_OUTPUT_LOCAL
|
186 |
|
|
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
|
187 |
|
|
( fputs (".lcomm ", (FILE)), \
|
188 |
|
|
assemble_name ((FILE), (NAME)), \
|
189 |
|
|
fprintf ((FILE), ",%u\n", (int)(SIZE)))
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
/* XXX
|
193 |
|
|
This is the end of the chunk lifted from m68kelf.h */
|
194 |
|
|
|
195 |
|
|
|
196 |
|
|
/* XXX
|
197 |
|
|
The following chunk is more or less lifted from m68kv4.h.
|
198 |
|
|
We'd like to just #include that file, but it has not yet
|
199 |
|
|
been converted to the new include style.
|
200 |
|
|
|
201 |
|
|
Should there be a m68kv4-abi.h ?? */
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
/* Register in which address to store a structure value is passed to a
|
205 |
|
|
function. The default in m68k.h is a1. For m68k/SVR4 it is a0. */
|
206 |
|
|
|
207 |
|
|
#undef M68K_STRUCT_VALUE_REGNUM
|
208 |
|
|
#define M68K_STRUCT_VALUE_REGNUM A0_REG
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
/* Register in which static-chain is passed to a function. The
|
212 |
|
|
default isn m68k.h is a0, but that is already the struct value
|
213 |
|
|
regnum. Make it a1 instead. */
|
214 |
|
|
|
215 |
|
|
#undef STATIC_CHAIN_REGNUM
|
216 |
|
|
#define STATIC_CHAIN_REGNUM A1_REG
|
217 |
|
|
#undef M68K_STATIC_CHAIN_REG_NAME
|
218 |
|
|
#define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
/* Now to renumber registers for dbx and gdb.
|
222 |
|
|
We use the Sun-3 convention, which is:
|
223 |
|
|
floating point registers have numbers 18 to 25, not
|
224 |
|
|
16 to 23 as they do in the compiler. */
|
225 |
|
|
|
226 |
|
|
#undef DBX_REGISTER_NUMBER
|
227 |
|
|
#define DBX_REGISTER_NUMBER(REGNO) ((REGNO) < 16 ? (REGNO) : (REGNO) + 2)
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
/* 1 if N is a possible register number for a function value. For
|
231 |
|
|
m68k/SVR4 allow d0, a0, or fp0 as return registers, for integral,
|
232 |
|
|
pointer, or floating types, respectively. Reject fp0 if not using
|
233 |
|
|
a 68881 coprocessor. */
|
234 |
|
|
|
235 |
|
|
#undef FUNCTION_VALUE_REGNO_P
|
236 |
|
|
#define FUNCTION_VALUE_REGNO_P(N) \
|
237 |
|
|
((N) == D0_REG || (N) == A0_REG || (TARGET_68881 && (N) == FP0_REG))
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
/* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
|
241 |
|
|
more than one register. */
|
242 |
|
|
|
243 |
|
|
#undef NEEDS_UNTYPED_CALL
|
244 |
|
|
#define NEEDS_UNTYPED_CALL 1
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
/* Define how to generate (in the callee) the output value of a
|
248 |
|
|
function and how to find (in the caller) the value returned by a
|
249 |
|
|
function. VALTYPE is the data type of the value (as a tree). If
|
250 |
|
|
the precise function being called is known, FUNC is its
|
251 |
|
|
FUNCTION_DECL; otherwise, FUNC is 0. For m68k/SVR4 generate the
|
252 |
|
|
result in d0, a0, or fp0 as appropriate. */
|
253 |
|
|
|
254 |
|
|
#undef FUNCTION_VALUE
|
255 |
|
|
#define FUNCTION_VALUE(VALTYPE, FUNC) \
|
256 |
|
|
m68k_function_value (VALTYPE, FUNC)
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
/* Define how to find the value returned by a library function
|
260 |
|
|
assuming the value has mode MODE.
|
261 |
|
|
For m68k/SVR4 look for integer values in d0, pointer values in d0
|
262 |
|
|
(returned in both d0 and a0), and floating values in fp0. */
|
263 |
|
|
|
264 |
|
|
#undef LIBCALL_VALUE
|
265 |
|
|
#define LIBCALL_VALUE(MODE) \
|
266 |
|
|
m68k_libcall_value (MODE)
|
267 |
|
|
|
268 |
|
|
|
269 |
|
|
/* Boundary (in *bits*) on which stack pointer should be aligned.
|
270 |
|
|
The m68k/SVR4 convention is to keep the stack pointer longword aligned. */
|
271 |
|
|
|
272 |
|
|
#undef STACK_BOUNDARY
|
273 |
|
|
#define STACK_BOUNDARY 32
|
274 |
|
|
|
275 |
|
|
|
276 |
|
|
/* Alignment of field after `int : 0' in a structure.
|
277 |
|
|
For m68k/SVR4, this is the next longword boundary. */
|
278 |
|
|
|
279 |
|
|
#undef EMPTY_FIELD_BOUNDARY
|
280 |
|
|
#define EMPTY_FIELD_BOUNDARY 32
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
/* No data type wants to be aligned rounder than this.
|
284 |
|
|
For m68k/SVR4, some types (doubles for example) are aligned on 8 byte
|
285 |
|
|
boundaries */
|
286 |
|
|
|
287 |
|
|
#undef BIGGEST_ALIGNMENT
|
288 |
|
|
#define BIGGEST_ALIGNMENT 64
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
/* The svr4 ABI for the m68k says that records and unions are returned
|
292 |
|
|
in memory. */
|
293 |
|
|
|
294 |
|
|
#undef DEFAULT_PCC_STRUCT_RETURN
|
295 |
|
|
#define DEFAULT_PCC_STRUCT_RETURN 1
|
296 |
|
|
|
297 |
|
|
/* XXX
|
298 |
|
|
This is the end of the chunk lifted from m68kv4.h */
|