Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / config / mips / netbsd.h
blobff32858018137ec48840ae94fa7c8d6e3d53c72e
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 2007, 2010 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 3, or (at your option)
10 any later version.
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 COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
22 /* Define default target values. */
24 #undef MACHINE_TYPE
25 #if TARGET_ENDIAN_DEFAULT != 0
26 #define MACHINE_TYPE "NetBSD/mipseb ELF"
27 #else
28 #define MACHINE_TYPE "NetBSD/mipsel ELF"
29 #endif
31 #define TARGET_OS_CPP_BUILTINS() \
32 do \
33 { \
34 NETBSD_OS_CPP_BUILTINS_ELF(); \
35 builtin_define ("__NO_LEADING_UNDERSCORES__"); \
36 builtin_define ("__GP_SUPPORT__"); \
37 if (TARGET_LONG64) \
38 builtin_define ("__LONG64"); \
40 if (TARGET_ABICALLS) \
41 builtin_define ("__ABICALLS__"); \
43 if (mips_abi == ABI_EABI) \
44 builtin_define ("__mips_eabi"); \
45 else if (mips_abi == ABI_N32) \
46 builtin_define ("__mips_n32"); \
47 else if (mips_abi == ABI_64) \
48 builtin_define ("__mips_n64"); \
49 else if (mips_abi == ABI_O64) \
50 builtin_define ("__mips_o64"); \
51 } \
52 while (0)
54 /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD.
55 Specifically, they define too many namespace-invasive macros. Override
56 them here. Note this is structured for easy comparison to the version
57 in mips.h.
59 FIXME: This probably isn't the best solution. But in the absence
60 of something better, it will have to do, for now. */
62 #undef TARGET_CPU_CPP_BUILTINS
63 #define TARGET_CPU_CPP_BUILTINS() \
64 do \
65 { \
66 builtin_assert ("cpu=mips"); \
67 builtin_define ("__mips__"); \
68 builtin_define ("_mips"); \
70 /* No _R3000 or _R4000. */ \
71 if (TARGET_64BIT) \
72 builtin_define ("__mips64"); \
74 if (TARGET_FLOAT64) \
75 builtin_define ("__mips_fpr=64"); \
76 else \
77 builtin_define ("__mips_fpr=32"); \
79 if (TARGET_MIPS16) \
80 builtin_define ("__mips16"); \
82 MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \
83 MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \
85 if (ISA_MIPS1) \
86 builtin_define ("__mips=1"); \
87 else if (ISA_MIPS2) \
88 builtin_define ("__mips=2"); \
89 else if (ISA_MIPS3) \
90 builtin_define ("__mips=3"); \
91 else if (ISA_MIPS4) \
92 builtin_define ("__mips=4"); \
93 else if (ISA_MIPS32) \
94 { \
95 builtin_define ("__mips=32"); \
96 builtin_define ("__mips_isa_rev=1"); \
97 } \
98 else if (ISA_MIPS32R2) \
99 { \
100 builtin_define ("__mips=32"); \
101 builtin_define ("__mips_isa_rev=2"); \
103 else if (ISA_MIPS64) \
105 builtin_define ("__mips=64"); \
106 builtin_define ("__mips_isa_rev=1"); \
109 if (TARGET_HARD_FLOAT) \
110 builtin_define ("__mips_hard_float"); \
111 else if (TARGET_SOFT_FLOAT) \
112 builtin_define ("__mips_soft_float"); \
114 if (TARGET_SINGLE_FLOAT) \
115 builtin_define ("__mips_single_float"); \
117 if (TARGET_BIG_ENDIAN) \
118 builtin_define ("__MIPSEB__"); \
119 else \
120 builtin_define ("__MIPSEL__"); \
122 /* No language dialect defines. */ \
124 /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \
126 while (0)
129 /* Clean up after the generic MIPS/ELF configuration. */
130 #undef MD_EXEC_PREFIX
131 #undef MD_STARTFILE_PREFIX
133 /* Extra specs we need. */
134 #undef SUBTARGET_EXTRA_SPECS
135 #define SUBTARGET_EXTRA_SPECS \
136 { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
137 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
138 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
140 /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */
142 #undef SUBTARGET_CPP_SPEC
143 #define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)"
145 /* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
146 This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
147 the MIPS target. */
149 #undef LINK_SPEC
150 #define LINK_SPEC \
151 "%{EL:-m elf32lmip} \
152 %{EB:-m elf32bmip} \
153 %(endian_spec) \
154 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \
155 %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
156 %(netbsd_link_spec)"
158 #define NETBSD_ENTRY_POINT "__start"
160 #undef SUBTARGET_ASM_SPEC
161 #define SUBTARGET_ASM_SPEC \
162 "%{!mno-abicalls: \
163 %{!fno-PIC:%{!fno-pic:-KPIC}}}"
166 /* -G is incompatible with -KPIC which is the default, so only allow objects
167 in the small data section if the user explicitly asks for it. */
169 #undef MIPS_DEFAULT_GVALUE
170 #define MIPS_DEFAULT_GVALUE 0
173 #undef ASM_FINAL_SPEC
174 #undef SET_ASM_OP
177 /* NetBSD hasn't historically provided _flush_cache(), but rather
178 _cacheflush(), which takes the same arguments as the former. */
179 #undef CACHE_FLUSH_FUNC
180 #define CACHE_FLUSH_FUNC "_cacheflush"
183 /* Make gcc agree with <machine/ansi.h> */
185 #undef WCHAR_TYPE
186 #define WCHAR_TYPE "int"
188 #undef WCHAR_TYPE_SIZE
189 #define WCHAR_TYPE_SIZE 32
191 #undef WINT_TYPE
192 #define WINT_TYPE "int"