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 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
69 %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
75 /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
76 but trashed by config/mips/elf.h. */
78 #define STARTFILE_SPEC FBSD_STARTFILE_SPEC
80 /* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386. */
82 #define ENDFILE_SPEC FBSD_ENDFILE_SPEC
84 /* Reset our LIB_SPEC which was properly set in config/freebsd.h
85 but trashed by config/mips/elf.h. */
87 #define LIB_SPEC FBSD_LIB_SPEC
89 /* config/mips/mips.h defines CPP_SPEC, and it expects SUBTARGET_CPP_SPEC. */
90 #undef SUBTARGET_CPP_SPEC
91 #define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
94 /************************[ Target stuff ]***********************************/
96 /* Define the actual types of some ANSI-mandated types.
97 Needs to agree with <machine/ansi.h>. GCC defaults come from c-decl.c,
98 c-common.c, and config/<arch>/<arch>.h. */
100 #if TARGET_ENDIAN_DEFAULT != 0
101 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/mips)");
103 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/mipsel)");
106 /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for FreeBSD.
107 Specifically, they define too many namespace-invasive macros. Override
108 them here. Note this is structured for easy comparison to the version
111 #undef TARGET_CPU_CPP_BUILTINS
112 #define TARGET_CPU_CPP_BUILTINS() \
115 builtin_assert ("machine=mips"); \
116 builtin_assert ("cpu=mips"); \
117 builtin_define ("__mips__"); \
120 builtin_define ("__mips64__"); \
122 if (TARGET_FLOAT64) \
123 builtin_define ("__mips_fpr=64"); \
125 builtin_define ("__mips_fpr=32"); \
128 builtin_define ("__mips16"); \
130 MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \
131 MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \
134 builtin_define ("__mips=3"); \
135 else if (ISA_MIPS4) \
136 builtin_define ("__mips=4"); \
137 else if (ISA_MIPS32) \
139 builtin_define ("__mips=32"); \
140 builtin_define ("__mips_isa_rev=1"); \
142 else if (ISA_MIPS32R2) \
144 builtin_define ("__mips=32"); \
145 builtin_define ("__mips_isa_rev=2"); \
147 else if (ISA_MIPS64) \
149 builtin_define ("__mips=64"); \
150 builtin_define ("__mips_isa_rev=1"); \
153 if (TARGET_HARD_FLOAT) \
154 builtin_define ("__mips_hard_float"); \
155 else if (TARGET_SOFT_FLOAT) \
156 builtin_define ("__mips_soft_float"); \
158 if (TARGET_SINGLE_FLOAT) \
159 builtin_define ("__mips_single_float"); \
161 if (TARGET_BIG_ENDIAN) \
162 builtin_define ("__MIPSEB__"); \
164 builtin_define ("__MIPSEL__"); \
166 /* No language dialect defines. */ \
168 if (mips_abi == ABI_EABI) \
169 builtin_define ("__mips_eabi"); \
170 else if (mips_abi == ABI_N32) \
171 builtin_define ("__mips_n32"); \
172 else if (mips_abi == ABI_64) \
173 builtin_define ("__mips_n64"); \
174 else if (mips_abi == ABI_O64) \
175 builtin_define ("__mips_o64"); \
177 builtin_define ("__mips_o32"); \
179 if (TARGET_ABICALLS) \
180 builtin_define ("__ABICALLS__"); \
184 /* Default to the mips32 ISA */
185 #undef DRIVER_SELF_SPECS
186 #define DRIVER_SELF_SPECS \
187 "%{!march=*: -march=mips32}"
189 "%{!EB:%{!EL:%(endian_spec)}}",
193 /* Don't default to pcc-struct-return, we want to retain compatibility with
194 older gcc versions AND pcc-struct-return is nonreentrant.
195 (even though the SVR4 ABI for the i386 says that records and unions are
196 returned in memory). */
198 #undef DEFAULT_PCC_STRUCT_RETURN
199 #define DEFAULT_PCC_STRUCT_RETURN 0
203 /************************[ Assembler stuff ]********************************/
205 #undef SUBTARGET_ASM_SPEC
206 #define SUBTARGET_ASM_SPEC \
207 "%{!mno-abicalls: %{!fno-PIC:%{!fno-pic:-KPIC}}}"
209 /* -G is incompatible with -KPIC which is the default, so only allow objects
210 in the small data section if the user explicitly asks for it. */
212 #undef MIPS_DEFAULT_GVALUE
213 #define MIPS_DEFAULT_GVALUE 0
215 /* If defined, a C expression whose value is a string containing the
216 assembler operation to identify the following data as
217 uninitialized global data. If not defined, and neither
218 `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
219 uninitialized global data will be output in the data section if
220 `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
222 #undef BSS_SECTION_ASM_OP
223 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
225 /* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
226 separate, explicit argument. If you define this macro, it is used
227 in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
228 handling the required alignment of the variable. The alignment is
229 specified as the number of bits.
231 Try to use function `asm_output_aligned_bss' defined in file
232 `varasm.c' when defining this macro. */
233 #undef ASM_OUTPUT_ALIGNED_BSS
234 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
235 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
237 /* Standard AT&T UNIX 'as' local label spelling. */
238 #undef LOCAL_LABEL_PREFIX
239 #define LOCAL_LABEL_PREFIX "."
242 /************************[ Debugger stuff ]*********************************/