1 /* Definitions of target machine for GNU compiler, for MIPS NetBSD systems.
2 Copyright (C) 1993-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
21 /* Define default target values. */
23 #define TARGET_OS_CPP_BUILTINS() \
26 NETBSD_OS_CPP_BUILTINS_ELF(); \
27 builtin_define ("__NO_LEADING_UNDERSCORES__"); \
28 builtin_define ("__GP_SUPPORT__"); \
30 builtin_define ("__LONG64"); \
32 if (TARGET_ABICALLS) \
33 builtin_define ("__ABICALLS__"); \
35 if (mips_abi == ABI_32) \
36 builtin_define ("__mips_o32"); \
37 else if (mips_abi == ABI_EABI) \
38 builtin_define ("__mips_eabi"); \
39 else if (mips_abi == ABI_N32) \
40 builtin_define ("__mips_n32"); \
41 else if (mips_abi == ABI_64) \
42 builtin_define ("__mips_n64"); \
43 else if (mips_abi == ABI_O64) \
44 builtin_define ("__mips_o64"); \
48 /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD.
49 Specifically, they define too many namespace-invasive macros. Override
50 them here. Note this is structured for easy comparison to the version
53 FIXME: This probably isn't the best solution. But in the absence
54 of something better, it will have to do, for now. */
56 #undef TARGET_CPU_CPP_BUILTINS
57 #define TARGET_CPU_CPP_BUILTINS() \
60 builtin_assert ("cpu=mips"); \
61 builtin_define ("__mips__"); \
62 builtin_define ("_mips"); \
64 /* No _R3000 or _R4000. */ \
66 builtin_define ("__mips64"); \
69 builtin_define ("__mips_fpr=64"); \
71 builtin_define ("__mips_fpr=32"); \
74 builtin_define ("__mips16"); \
76 MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \
77 MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \
80 builtin_define ("__mips=1"); \
82 builtin_define ("__mips=2"); \
84 builtin_define ("__mips=3"); \
86 builtin_define ("__mips=4"); \
87 else if (mips_isa >= 32 && mips_isa < 64) \
88 builtin_define ("__mips=32"); \
89 else if (mips_isa >= 64) \
90 builtin_define ("__mips=64"); \
91 if (mips_isa_rev > 0) \
92 builtin_define_with_int_value ("__mips_isa_rev", \
95 if (TARGET_HARD_FLOAT) \
96 builtin_define ("__mips_hard_float"); \
97 else if (TARGET_SOFT_FLOAT) \
98 builtin_define ("__mips_soft_float"); \
100 if (TARGET_SINGLE_FLOAT) \
101 builtin_define ("__mips_single_float"); \
103 if (TARGET_BIG_ENDIAN) \
104 builtin_define ("__MIPSEB__"); \
106 builtin_define ("__MIPSEL__"); \
108 /* No language dialect defines. */ \
110 /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \
115 /* Extra specs we need. */
116 #undef SUBTARGET_EXTRA_SPECS
117 #define SUBTARGET_EXTRA_SPECS \
118 { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
119 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
120 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
122 /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */
124 #undef SUBTARGET_CPP_SPEC
125 #define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)"
127 /* Provide a LINK_SPEC appropriate for a NetBSD/mips target.
128 This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for
133 "%{EL:-m elf32lmip} \
136 %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} \
137 %{mips32r6} %{mips64} %{mips64r6} \
140 #define NETBSD_ENTRY_POINT "__start"
142 #undef SUBTARGET_ASM_SPEC
143 #define SUBTARGET_ASM_SPEC \
145 %{!fno-PIC:%{!fno-pic:-KPIC}}}"
148 /* -G is incompatible with -KPIC which is the default, so only allow objects
149 in the small data section if the user explicitly asks for it. */
151 #undef MIPS_DEFAULT_GVALUE
152 #define MIPS_DEFAULT_GVALUE 0
155 #undef ASM_FINAL_SPEC
159 /* NetBSD hasn't historically provided _flush_cache(), but rather
160 _cacheflush(), which takes the same arguments as the former. */
161 #undef CACHE_FLUSH_FUNC
162 #define CACHE_FLUSH_FUNC "_cacheflush"
165 /* Make gcc agree with <machine/ansi.h> */
168 #define WCHAR_TYPE "int"
170 #undef WCHAR_TYPE_SIZE
171 #define WCHAR_TYPE_SIZE 32
174 #define WINT_TYPE "int"