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