]>
Commit | Line | Data |
---|---|---|
f982f805 | 1 | /* Definitions of target machine for GNU compiler, for MIPS NetBSD systems. |
a945c346 | 2 | Copyright (C) 1993-2024 Free Software Foundation, Inc. |
f5acdcc1 | 3 | |
7ec022b2 | 4 | This file is part of GCC. |
f5acdcc1 | 5 | |
7ec022b2 | 6 | GCC is free software; you can redistribute it and/or modify |
f5acdcc1 | 7 | it under the terms of the GNU General Public License as published by |
2f83c7d6 | 8 | the Free Software Foundation; either version 3, or (at your option) |
f5acdcc1 JW |
9 | any later version. |
10 | ||
7ec022b2 | 11 | GCC is distributed in the hope that it will be useful, |
f5acdcc1 JW |
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. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
2f83c7d6 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
f5acdcc1 | 19 | |
f5acdcc1 | 20 | |
031a26c5 | 21 | /* Define default target values. */ |
f5acdcc1 | 22 | |
e1c293ae JT |
23 | #define TARGET_OS_CPP_BUILTINS() \ |
24 | do \ | |
25 | { \ | |
26 | NETBSD_OS_CPP_BUILTINS_ELF(); \ | |
27 | builtin_define ("__NO_LEADING_UNDERSCORES__"); \ | |
e1c293ae | 28 | builtin_define ("__GP_SUPPORT__"); \ |
e1c293ae JT |
29 | if (TARGET_LONG64) \ |
30 | builtin_define ("__LONG64"); \ | |
a24f7c1a | 31 | \ |
d8986082 JT |
32 | if (TARGET_ABICALLS) \ |
33 | builtin_define ("__ABICALLS__"); \ | |
34 | \ | |
8785c60a MH |
35 | if (mips_abi == ABI_32) \ |
36 | builtin_define ("__mips_o32"); \ | |
37 | else if (mips_abi == ABI_EABI) \ | |
a24f7c1a JT |
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"); \ | |
e1c293ae JT |
45 | } \ |
46 | while (0) | |
47 | ||
a24f7c1a JT |
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 | |
51 | in mips.h. | |
52 | ||
dab66575 | 53 | FIXME: This probably isn't the best solution. But in the absence |
a24f7c1a JT |
54 | of something better, it will have to do, for now. */ |
55 | ||
56 | #undef TARGET_CPU_CPP_BUILTINS | |
57 | #define TARGET_CPU_CPP_BUILTINS() \ | |
58 | do \ | |
59 | { \ | |
60 | builtin_assert ("cpu=mips"); \ | |
61 | builtin_define ("__mips__"); \ | |
62 | builtin_define ("_mips"); \ | |
63 | \ | |
64 | /* No _R3000 or _R4000. */ \ | |
65 | if (TARGET_64BIT) \ | |
66 | builtin_define ("__mips64"); \ | |
67 | \ | |
68 | if (TARGET_FLOAT64) \ | |
69 | builtin_define ("__mips_fpr=64"); \ | |
70 | else \ | |
71 | builtin_define ("__mips_fpr=32"); \ | |
72 | \ | |
73 | if (TARGET_MIPS16) \ | |
74 | builtin_define ("__mips16"); \ | |
75 | \ | |
76 | MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ | |
77 | MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ | |
78 | \ | |
79 | if (ISA_MIPS1) \ | |
80 | builtin_define ("__mips=1"); \ | |
81 | else if (ISA_MIPS2) \ | |
82 | builtin_define ("__mips=2"); \ | |
83 | else if (ISA_MIPS3) \ | |
84 | builtin_define ("__mips=3"); \ | |
85 | else if (ISA_MIPS4) \ | |
86 | builtin_define ("__mips=4"); \ | |
4ecfc7e3 YS |
87 | else if (mips_isa >= MIPS_ISA_MIPS32 \ |
88 | && mips_isa < MIPS_ISA_MIPS64) \ | |
82f84ecb | 89 | builtin_define ("__mips=32"); \ |
8137be39 | 90 | else if (mips_isa >= MIPS_ISA_MIPS64) \ |
82f84ecb MF |
91 | builtin_define ("__mips=64"); \ |
92 | if (mips_isa_rev > 0) \ | |
93 | builtin_define_with_int_value ("__mips_isa_rev", \ | |
94 | mips_isa_rev); \ | |
a24f7c1a JT |
95 | \ |
96 | if (TARGET_HARD_FLOAT) \ | |
97 | builtin_define ("__mips_hard_float"); \ | |
98 | else if (TARGET_SOFT_FLOAT) \ | |
99 | builtin_define ("__mips_soft_float"); \ | |
100 | \ | |
101 | if (TARGET_SINGLE_FLOAT) \ | |
102 | builtin_define ("__mips_single_float"); \ | |
103 | \ | |
104 | if (TARGET_BIG_ENDIAN) \ | |
105 | builtin_define ("__MIPSEB__"); \ | |
106 | else \ | |
107 | builtin_define ("__MIPSEL__"); \ | |
108 | \ | |
109 | /* No language dialect defines. */ \ | |
110 | \ | |
111 | /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \ | |
112 | } \ | |
113 | while (0) | |
114 | ||
f5acdcc1 | 115 | |
e1c293ae JT |
116 | /* Extra specs we need. */ |
117 | #undef SUBTARGET_EXTRA_SPECS | |
118 | #define SUBTARGET_EXTRA_SPECS \ | |
1569d670 JT |
119 | { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \ |
120 | { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ | |
121 | { "netbsd_entry_point", NETBSD_ENTRY_POINT }, | |
e1c293ae | 122 | |
e1c293ae | 123 | /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */ |
f982f805 JT |
124 | |
125 | #undef SUBTARGET_CPP_SPEC | |
e1c293ae | 126 | #define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)" |
f5acdcc1 | 127 | |
f982f805 JT |
128 | /* Provide a LINK_SPEC appropriate for a NetBSD/mips target. |
129 | This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for | |
130 | the MIPS target. */ | |
f5acdcc1 | 131 | |
f982f805 | 132 | #undef LINK_SPEC |
1569d670 JT |
133 | #define LINK_SPEC \ |
134 | "%{EL:-m elf32lmip} \ | |
135 | %{EB:-m elf32bmip} \ | |
136 | %(endian_spec) \ | |
82f84ecb MF |
137 | %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} \ |
138 | %{mips32r6} %{mips64} %{mips64r6} \ | |
1569d670 JT |
139 | %(netbsd_link_spec)" |
140 | ||
141 | #define NETBSD_ENTRY_POINT "__start" | |
f982f805 JT |
142 | |
143 | #undef SUBTARGET_ASM_SPEC | |
9f689d92 JT |
144 | #define SUBTARGET_ASM_SPEC \ |
145 | "%{!mno-abicalls: \ | |
146 | %{!fno-PIC:%{!fno-pic:-KPIC}}}" | |
f982f805 JT |
147 | |
148 | ||
149 | /* -G is incompatible with -KPIC which is the default, so only allow objects | |
150 | in the small data section if the user explicitly asks for it. */ | |
151 | ||
ce3649d2 EC |
152 | #undef MIPS_DEFAULT_GVALUE |
153 | #define MIPS_DEFAULT_GVALUE 0 | |
f982f805 JT |
154 | |
155 | ||
f5acdcc1 | 156 | #undef ASM_FINAL_SPEC |
f982f805 JT |
157 | #undef SET_ASM_OP |
158 | ||
159 | ||
ac64a17c JT |
160 | /* NetBSD hasn't historically provided _flush_cache(), but rather |
161 | _cacheflush(), which takes the same arguments as the former. */ | |
162 | #undef CACHE_FLUSH_FUNC | |
163 | #define CACHE_FLUSH_FUNC "_cacheflush" | |
164 | ||
165 | ||
f982f805 JT |
166 | /* Make gcc agree with <machine/ansi.h> */ |
167 | ||
168 | #undef WCHAR_TYPE | |
169 | #define WCHAR_TYPE "int" | |
170 | ||
f982f805 JT |
171 | #undef WCHAR_TYPE_SIZE |
172 | #define WCHAR_TYPE_SIZE 32 | |
173 | ||
174 | #undef WINT_TYPE | |
175 | #define WINT_TYPE "int" |