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