1 /* Definitions for MIPS varients running FreeBSD with ELF format
2 Copyright (C) 2008 Free Software Foundation, Inc.
3 Continued by David O'Brien <obrien@freebsd.org>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
24 /* This defines which switch letters take arguments. -G is a MIPS
27 #undef SWITCH_TAKES_ARG
28 #define SWITCH_TAKES_ARG(CHAR) \
29 (FBSD_SWITCH_TAKES_ARG (CHAR) \
33 #undef SUBTARGET_EXTRA_SPECS /* mips.h bogusly defines it. */
34 #define SUBTARGET_EXTRA_SPECS \
35 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER}, \
36 { "fbsd_link_spec", FBSD_LINK_SPEC }
38 /* config/mips/mips.h defines CC1_SPEC,
39 but gives us an "out" with SUBTARGET_CC1_SPEC. */
40 #undef SUBTARGET_CC1_SPEC
41 #define SUBTARGET_CC1_SPEC "%{profile:-p}"
43 /* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support
44 for the special GCC options -static and -shared, which allow us to
45 link things in one of these three modes by applying the appropriate
46 combinations of options at link-time. We like to support here for
47 as many of the other GNU linker options as possible. But I don't
48 have the time to search for those flags. I am sure how to add
49 support for -soname shared_object_name. H.J.
51 When the -shared link option is used a final link is not being
54 #define FBSD_LINK_SPEC "\
55 %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \
57 %{assert*} %{R*} %{rpath*} %{defsym*} \
58 %{shared:-Bshareable %{h*} %{soname*}} \
61 %{rdynamic: -export-dynamic} \
62 %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
64 %{symbolic:-Bsymbolic} "
68 %{EB} %{EL} %(endian_spec) \
69 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} \
70 %{mips32} %{mips32r2} %{mips64} %{mips64r2} \
71 %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
72 %{mabi=32:-melf32%{EB:b}%{EL:l}tsmip_fbsd} \
73 %{mabi=n32:-melf32%{EB:b}%{EL:l}tsmipn32_fbsd} \
74 %{mabi=64:-melf64%{EB:b}%{EL:l}tsmip_fbsd} \
75 %{mabi=o64:-melf64%{EB:b}%{EL:l}tsmip_fbsd} \
79 /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
80 but trashed by config/mips/elf.h. */
82 #define STARTFILE_SPEC FBSD_STARTFILE_SPEC
84 /* Provide an ENDFILE_SPEC appropriate for FreeBSD/mips. */
86 #define ENDFILE_SPEC FBSD_ENDFILE_SPEC
88 /* Reset our LIB_SPEC which was properly set in config/freebsd.h
89 but trashed by config/mips/elf.h. */
91 #define LIB_SPEC FBSD_LIB_SPEC
93 /* config/mips/mips.h defines CPP_SPEC, and it expects SUBTARGET_CPP_SPEC. */
94 #undef SUBTARGET_CPP_SPEC
95 #define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
98 /************************[ Target stuff ]***********************************/
100 /* Define the actual types of some ANSI-mandated types.
101 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
102 c-common.c, and config/<arch>/<arch>.h. */
104 #undef TARGET_DEFAULT
105 #define TARGET_DEFAULT (MASK_ABICALLS | MASK_SOFT_FLOAT)
107 #if TARGET_ENDIAN_DEFAULT != 0
108 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/mips)");
110 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/mipsel)");
113 /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for FreeBSD.
114 Specifically, they define too many namespace-invasive macros. Override
115 them here. Note this is structured for easy comparison to the version
118 #undef TARGET_CPU_CPP_BUILTINS
119 #define TARGET_CPU_CPP_BUILTINS() \
122 builtin_assert ("machine=mips"); \
123 builtin_assert ("cpu=mips"); \
124 builtin_define ("__mips__"); \
127 builtin_define ("__mips64__"); \
129 if (TARGET_FLOAT64) \
130 builtin_define ("__mips_fpr=64"); \
132 builtin_define ("__mips_fpr=32"); \
135 builtin_define ("__mips16"); \
137 if (mips_abi == ABI_N32) \
139 builtin_define ("__mips_n32"); \
140 builtin_define ("_ABIN32=2"); \
141 builtin_define ("_MIPS_SIM=_ABIN32"); \
142 builtin_define ("_MIPS_SZLONG=32"); \
143 builtin_define ("_MIPS_SZPTR=32"); \
145 else if (mips_abi == ABI_64) \
147 builtin_define ("__mips_n64"); \
148 builtin_define ("_ABI64=3"); \
149 builtin_define ("_MIPS_SIM=_ABI64"); \
150 builtin_define ("_MIPS_SZLONG=64"); \
151 builtin_define ("_MIPS_SZPTR=64"); \
153 else if (mips_abi == ABI_O64) \
155 builtin_define ("__mips_o64"); \
156 builtin_define ("_ABIO64=4"); \
157 builtin_define ("_MIPS_SIM=_ABIO64"); \
158 builtin_define ("_MIPS_SZLONG=64"); \
159 builtin_define ("_MIPS_SZPTR=64"); \
161 else if (mips_abi == ABI_EABI) \
163 builtin_define ("__mips_eabi"); \
164 builtin_define ("_ABIEMB=5"); \
165 builtin_define ("_MIPS_SIM=_ABIEMB"); \
167 builtin_define ("_MIPS_SZLONG=64"); \
169 builtin_define ("_MIPS_SZLONG=32"); \
171 builtin_define ("_MIPS_SZPTR=64"); \
173 builtin_define ("_MIPS_SZPTR=32"); \
177 builtin_define ("__mips_o32"); \
178 builtin_define ("_ABIO32=1"); \
179 builtin_define ("_MIPS_SIM=_ABIO32"); \
180 builtin_define ("_MIPS_SZLONG=32"); \
181 builtin_define ("_MIPS_SZPTR=32"); \
183 if (TARGET_FLOAT64) \
184 builtin_define ("_MIPS_FPSET=32"); \
186 builtin_define ("_MIPS_FPSET=16"); \
188 builtin_define ("_MIPS_SZINT=32"); \
190 MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \
191 MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \
195 builtin_define ("__mips=1"); \
196 builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS1"); \
198 else if (ISA_MIPS2) \
200 builtin_define ("__mips=2"); \
201 builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS2"); \
203 else if (ISA_MIPS3) \
205 builtin_define ("__mips=3"); \
206 builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS3"); \
208 else if (ISA_MIPS4) \
210 builtin_define ("__mips=4"); \
211 builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS4"); \
213 else if (ISA_MIPS32) \
215 builtin_define ("__mips=32"); \
216 builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS32"); \
217 builtin_define ("__mips_isa_rev=1"); \
219 else if (ISA_MIPS32R2) \
221 builtin_define ("__mips=32"); \
222 builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS32"); \
223 builtin_define ("__mips_isa_rev=2"); \
225 else if (ISA_MIPS64) \
227 builtin_define ("__mips=64"); \
228 builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64"); \
229 builtin_define ("__mips_isa_rev=1"); \
231 /* else if (ISA_MIPS64R2) \
233 builtin_define ("__mips=64"); \
234 builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64"); \
235 builtin_define ("__mips_isa_rev=2"); \
238 if (TARGET_HARD_FLOAT) \
239 builtin_define ("__mips_hard_float"); \
240 else if (TARGET_SOFT_FLOAT) \
241 builtin_define ("__mips_soft_float"); \
243 if (TARGET_SINGLE_FLOAT) \
244 builtin_define ("__mips_single_float"); \
246 if (TARGET_BIG_ENDIAN) \
247 builtin_define ("__MIPSEB__"); \
249 builtin_define ("__MIPSEL__"); \
251 /* No language dialect defines. */ \
252 if (TARGET_ABICALLS) \
253 builtin_define ("__ABICALLS__"); \
257 /* Default ABI and ISA */
258 #undef DRIVER_SELF_SPECS
259 #if MIPS_ABI_DEFAULT == ABI_N32
260 #define DRIVER_SELF_SPECS \
261 "%{!EB:%{!EL:%(endian_spec)}}", \
262 "%{!march=*: -march=mips64}", \
263 "%{!mabi=*: -mabi=n32}"
264 #elif MIPS_ABI_DEFAULT == ABI_64
265 #define DRIVER_SELF_SPECS \
266 "%{!EB:%{!EL:%(endian_spec)}}", \
267 "%{!march=*: -march=mips64}", \
268 "%{!mabi=*: -mabi=64}"
269 #elif MIPS_ABI_DEFAULT == ABI_O64
270 #define DRIVER_SELF_SPECS \
271 "%{!EB:%{!EL:%(endian_spec)}}", \
272 "%{!march=*: -march=mips64}", \
273 "%{!mabi=*: -mabi=o64}"
274 #else /* default to o32 */
275 #define DRIVER_SELF_SPECS \
276 "%{!EB:%{!EL:%(endian_spec)}}", \
277 "%{!march=*: -march=mips32}", \
278 "%{!mabi=*: -mabi=32}"
282 /* Don't default to pcc-struct-return, we want to retain compatibility with
283 older gcc versions AND pcc-struct-return is nonreentrant.
284 (even though the SVR4 ABI for the i386 says that records and unions are
285 returned in memory). */
287 #undef DEFAULT_PCC_STRUCT_RETURN
288 #define DEFAULT_PCC_STRUCT_RETURN 0
292 /************************[ Assembler stuff ]********************************/
294 #undef SUBTARGET_ASM_SPEC
295 #define SUBTARGET_ASM_SPEC \
296 "%{!mno-abicalls: %{!fno-PIC:%{!fno-pic:-KPIC}}}"
298 /* -G is incompatible with -KPIC which is the default, so only allow objects
299 in the small data section if the user explicitly asks for it. */
301 #undef MIPS_DEFAULT_GVALUE
302 #define MIPS_DEFAULT_GVALUE 0
304 /* If defined, a C expression whose value is a string containing the
305 assembler operation to identify the following data as
306 uninitialized global data. If not defined, and neither
307 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
308 uninitialized global data will be output in the data section if
309 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
311 #undef BSS_SECTION_ASM_OP
312 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
314 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
315 separate, explicit argument. If you define this macro, it is used
316 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
317 handling the required alignment of the variable. The alignment is
318 specified as the number of bits.
320 Try to use function `asm_output_aligned_bss' defined in file
321 `varasm.c' when defining this macro. */
322 #undef ASM_OUTPUT_ALIGNED_BSS
323 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
324 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
326 /* Standard AT&T UNIX 'as' local label spelling. */
327 #undef LOCAL_LABEL_PREFIX
328 #define LOCAL_LABEL_PREFIX "."
330 /* Currently we don't support 128bit long doubles, so for now we force
332 #undef LONG_DOUBLE_TYPE_SIZE
333 #define LONG_DOUBLE_TYPE_SIZE 64
336 #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
337 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
340 /************************[ Debugger stuff ]*********************************/