1 /* Definitions of target machine for GNU compiler, for MIPS NetBSD systems.
2 Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004
3 Free Software Foundation, Inc.
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. */
23 /* Define default target values. */
26 #if TARGET_ENDIAN_DEFAULT != 0
27 #define MACHINE_TYPE "NetBSD/mipseb ELF"
29 #define MACHINE_TYPE "NetBSD/mipsel ELF"
32 #define TARGET_OS_CPP_BUILTINS() \
35 NETBSD_OS_CPP_BUILTINS_ELF(); \
36 builtin_define ("__NO_LEADING_UNDERSCORES__"); \
37 builtin_define ("__GP_SUPPORT__"); \
39 builtin_define ("__LONG64"); \
41 if (TARGET_ABICALLS) \
42 builtin_define ("__ABICALLS__"); \
44 /* The GNU C++ standard library requires this. */ \
45 if (c_dialect_cxx ()) \
46 builtin_define ("_GNU_SOURCE"); \
48 if (mips_abi == ABI_N32) \
50 builtin_define ("__mips_n32"); \
51 builtin_define ("_ABIN32=2"); \
52 builtin_define ("_MIPS_SIM=_ABIN32"); \
53 builtin_define ("_MIPS_SZLONG=32"); \
54 builtin_define ("_MIPS_SZPTR=32"); \
56 else if (mips_abi == ABI_64) \
58 builtin_define ("__mips_n64"); \
59 builtin_define ("_ABI64=3"); \
60 builtin_define ("_MIPS_SIM=_ABI64"); \
61 builtin_define ("_MIPS_SZLONG=64"); \
62 builtin_define ("_MIPS_SZPTR=64"); \
64 else if (mips_abi == ABI_O64) \
66 builtin_define ("__mips_o64"); \
67 builtin_define ("_ABIO64=4"); \
68 builtin_define ("_MIPS_SIM=_ABIO64"); \
69 builtin_define ("_MIPS_SZLONG=64"); \
70 builtin_define ("_MIPS_SZPTR=64"); \
72 else if (mips_abi == ABI_EABI) \
74 builtin_define ("__mips_eabi"); \
75 builtin_define ("_ABIEMB=5"); \
76 builtin_define ("_MIPS_SIM=_ABIEMB"); \
78 builtin_define ("_MIPS_SZLONG=64"); \
80 builtin_define ("_MIPS_SZLONG=32"); \
82 builtin_define ("_MIPS_SZPTR=64"); \
84 builtin_define ("_MIPS_SZPTR=32"); \
88 builtin_define ("__mips_o32"); \
89 builtin_define ("_ABIO32=1"); \
90 builtin_define ("_MIPS_SIM=_ABIO32"); \
91 builtin_define ("_MIPS_SZLONG=32"); \
92 builtin_define ("_MIPS_SZPTR=32"); \
95 builtin_define ("_MIPS_FPSET=32"); \
97 builtin_define ("_MIPS_FPSET=16"); \
99 builtin_define ("_MIPS_SZINT=32"); \
102 /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD.
103 Specifically, they define too many namespace-invasive macros. Override
104 them here. Note this is structured for easy comparison to the version
107 FIXME: This probably isn't the best solution. But in the absence
108 of something better, it will have to do, for now. */
110 #undef TARGET_CPU_CPP_BUILTINS
111 #define TARGET_CPU_CPP_BUILTINS() \
114 builtin_assert ("cpu=mips"); \
115 builtin_define ("__mips__"); \
116 builtin_define ("_mips"); \
118 /* No _R3000 or _R4000. */ \
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=1"); \
135 else if (ISA_MIPS2) \
136 builtin_define ("__mips=2"); \
137 else if (ISA_MIPS3) \
138 builtin_define ("__mips=3"); \
139 else if (ISA_MIPS4) \
140 builtin_define ("__mips=4"); \
141 else if (ISA_MIPS32) \
143 builtin_define ("__mips=32"); \
144 builtin_define ("__mips_isa_rev=1"); \
146 else if (ISA_MIPS32R2) \
148 builtin_define ("__mips=32"); \
149 builtin_define ("__mips_isa_rev=2"); \
151 else if (ISA_MIPS64) \
153 builtin_define ("__mips=64"); \
154 builtin_define ("__mips_isa_rev=1"); \
156 else if (ISA_MIPS64R2) \
158 builtin_define ("__mips=64"); \
159 builtin_define ("__mips_isa_rev=2"); \
162 if (TARGET_HARD_FLOAT) \
163 builtin_define ("__mips_hard_float"); \
164 else if (TARGET_SOFT_FLOAT) \
165 builtin_define ("__mips_soft_float"); \
167 if (TARGET_SINGLE_FLOAT) \
168 builtin_define ("__mips_single_float"); \
170 if (TARGET_BIG_ENDIAN) \
171 builtin_define ("__MIPSEB__"); \
173 builtin_define ("__MIPSEL__"); \
175 /* No language dialect defines. */ \
177 /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \
182 /* Clean up after the generic MIPS/ELF configuration. */
183 #undef MD_EXEC_PREFIX
184 #undef MD_STARTFILE_PREFIX
186 /* Extra specs we need. */
187 #undef SUBTARGET_EXTRA_SPECS
188 #define SUBTARGET_EXTRA_SPECS \
189 { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
190 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
191 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
193 /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */
195 #undef SUBTARGET_CPP_SPEC
196 #define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)"
198 /* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
199 This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
204 "%{EL:-m elf32ltsmip} \
205 %{EB:-m elf32btsmip} \
207 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} \
208 %{mips32} %{mips32r2} %{mips64} %{mips64r2} \
209 %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
212 #define NETBSD_ENTRY_POINT "__start"
214 #undef SUBTARGET_ASM_SPEC
215 #define SUBTARGET_ASM_SPEC \
217 %{!fno-PIC:%{!fno-pic:-KPIC}}}"
220 /* -G is incompatible with -KPIC which is the default, so only allow objects
221 in the small data section if the user explicitly asks for it. */
223 #undef MIPS_DEFAULT_GVALUE
224 #define MIPS_DEFAULT_GVALUE 0
227 /* This defines which switch letters take arguments. -G is a MIPS
230 #undef SWITCH_TAKES_ARG
231 #define SWITCH_TAKES_ARG(CHAR) \
232 (DEFAULT_SWITCH_TAKES_ARG (CHAR) \
237 #undef ASM_FINAL_SPEC
241 /* NetBSD hasn't historically provided _flush_cache(), but rather
242 _cacheflush(), which takes the same arguments as the former. */
243 #undef CACHE_FLUSH_FUNC
244 #define CACHE_FLUSH_FUNC "_cacheflush"
247 /* Make gcc agree with <machine/ansi.h> */
250 #define SIZE_TYPE ((POINTER_SIZE == 64 || TARGET_NEWABI) \
251 ? "long unsigned int" : "unsigned int")
254 #define PTRDIFF_TYPE ((POINTER_SIZE == 64 || TARGET_NEWABI) \
255 ? "long int" : "int")
258 #define WCHAR_TYPE "int"
260 #undef WCHAR_TYPE_SIZE
261 #define WCHAR_TYPE_SIZE 32
264 #define WINT_TYPE "int"