]>
Commit | Line | Data |
---|---|---|
f982f805 | 1 | /* Definitions of target machine for GNU compiler, for MIPS NetBSD systems. |
2d2a50c3 | 2 | Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003 |
f982f805 | 3 | Free Software Foundation, Inc. |
f5acdcc1 JW |
4 | |
5 | This file is part of GNU CC. | |
6 | ||
7 | GNU CC 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) | |
10 | any later version. | |
11 | ||
12 | GNU CC 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. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with GNU CC; see the file COPYING. If not, write to | |
0e29e3c9 RK |
19 | the Free Software Foundation, 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. */ | |
f5acdcc1 | 21 | |
f5acdcc1 | 22 | |
f982f805 | 23 | /* Define default target values. */ |
f5acdcc1 | 24 | |
27f4b67e | 25 | #undef MACHINE_TYPE |
f982f805 JT |
26 | #if TARGET_ENDIAN_DEFAULT != 0 |
27 | #define MACHINE_TYPE "NetBSD/mipseb ELF" | |
28 | #else | |
29 | #define MACHINE_TYPE "NetBSD/mipsel ELF" | |
30 | #endif | |
f5acdcc1 | 31 | |
e1c293ae JT |
32 | #define TARGET_OS_CPP_BUILTINS() \ |
33 | do \ | |
34 | { \ | |
35 | NETBSD_OS_CPP_BUILTINS_ELF(); \ | |
36 | builtin_define ("__NO_LEADING_UNDERSCORES__"); \ | |
e1c293ae JT |
37 | builtin_define ("__GP_SUPPORT__"); \ |
38 | builtin_assert ("machine=mips"); \ | |
39 | if (TARGET_LONG64) \ | |
40 | builtin_define ("__LONG64"); \ | |
a24f7c1a | 41 | \ |
d8986082 JT |
42 | if (TARGET_ABICALLS) \ |
43 | builtin_define ("__ABICALLS__"); \ | |
44 | \ | |
a24f7c1a JT |
45 | if (mips_abi == ABI_EABI) \ |
46 | builtin_define ("__mips_eabi"); \ | |
47 | else if (mips_abi == ABI_N32) \ | |
48 | builtin_define ("__mips_n32"); \ | |
49 | else if (mips_abi == ABI_64) \ | |
50 | builtin_define ("__mips_n64"); \ | |
51 | else if (mips_abi == ABI_O64) \ | |
52 | builtin_define ("__mips_o64"); \ | |
e1c293ae JT |
53 | } \ |
54 | while (0) | |
55 | ||
a24f7c1a JT |
56 | /* The generic MIPS TARGET_CPU_CPP_BUILTINS are incorrect for NetBSD. |
57 | Specifically, they define too many namespace-invasive macros. Override | |
58 | them here. Note this is structured for easy comparison to the version | |
59 | in mips.h. | |
60 | ||
dab66575 | 61 | FIXME: This probably isn't the best solution. But in the absence |
a24f7c1a JT |
62 | of something better, it will have to do, for now. */ |
63 | ||
64 | #undef TARGET_CPU_CPP_BUILTINS | |
65 | #define TARGET_CPU_CPP_BUILTINS() \ | |
66 | do \ | |
67 | { \ | |
68 | builtin_assert ("cpu=mips"); \ | |
69 | builtin_define ("__mips__"); \ | |
70 | builtin_define ("_mips"); \ | |
71 | \ | |
72 | /* No _R3000 or _R4000. */ \ | |
73 | if (TARGET_64BIT) \ | |
74 | builtin_define ("__mips64"); \ | |
75 | \ | |
76 | if (TARGET_FLOAT64) \ | |
77 | builtin_define ("__mips_fpr=64"); \ | |
78 | else \ | |
79 | builtin_define ("__mips_fpr=32"); \ | |
80 | \ | |
81 | if (TARGET_MIPS16) \ | |
82 | builtin_define ("__mips16"); \ | |
83 | \ | |
84 | MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ | |
85 | MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ | |
86 | \ | |
87 | if (ISA_MIPS1) \ | |
88 | builtin_define ("__mips=1"); \ | |
89 | else if (ISA_MIPS2) \ | |
90 | builtin_define ("__mips=2"); \ | |
91 | else if (ISA_MIPS3) \ | |
92 | builtin_define ("__mips=3"); \ | |
93 | else if (ISA_MIPS4) \ | |
94 | builtin_define ("__mips=4"); \ | |
95 | else if (ISA_MIPS32) \ | |
2d2a50c3 CD |
96 | { \ |
97 | builtin_define ("__mips=32"); \ | |
98 | builtin_define ("__mips_isa_rev=1"); \ | |
99 | } \ | |
100 | else if (ISA_MIPS32R2) \ | |
101 | { \ | |
102 | builtin_define ("__mips=32"); \ | |
103 | builtin_define ("__mips_isa_rev=2"); \ | |
104 | } \ | |
a24f7c1a | 105 | else if (ISA_MIPS64) \ |
2d2a50c3 CD |
106 | { \ |
107 | builtin_define ("__mips=64"); \ | |
108 | builtin_define ("__mips_isa_rev=1"); \ | |
109 | } \ | |
a24f7c1a JT |
110 | \ |
111 | if (TARGET_HARD_FLOAT) \ | |
112 | builtin_define ("__mips_hard_float"); \ | |
113 | else if (TARGET_SOFT_FLOAT) \ | |
114 | builtin_define ("__mips_soft_float"); \ | |
115 | \ | |
116 | if (TARGET_SINGLE_FLOAT) \ | |
117 | builtin_define ("__mips_single_float"); \ | |
118 | \ | |
119 | if (TARGET_BIG_ENDIAN) \ | |
120 | builtin_define ("__MIPSEB__"); \ | |
121 | else \ | |
122 | builtin_define ("__MIPSEL__"); \ | |
123 | \ | |
124 | /* No language dialect defines. */ \ | |
125 | \ | |
126 | /* ABIs handled in TARGET_OS_CPP_BUILTINS. */ \ | |
127 | } \ | |
128 | while (0) | |
129 | ||
f5acdcc1 | 130 | |
ca11c37c | 131 | /* Clean up after the generic MIPS/ELF configuration. */ |
f982f805 JT |
132 | #undef MD_EXEC_PREFIX |
133 | #undef MD_STARTFILE_PREFIX | |
f5acdcc1 | 134 | |
e1c293ae JT |
135 | /* Extra specs we need. */ |
136 | #undef SUBTARGET_EXTRA_SPECS | |
137 | #define SUBTARGET_EXTRA_SPECS \ | |
1569d670 JT |
138 | { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \ |
139 | { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \ | |
140 | { "netbsd_entry_point", NETBSD_ENTRY_POINT }, | |
e1c293ae | 141 | |
e1c293ae | 142 | /* Provide a SUBTARGET_CPP_SPEC appropriate for NetBSD. */ |
f982f805 JT |
143 | |
144 | #undef SUBTARGET_CPP_SPEC | |
e1c293ae | 145 | #define SUBTARGET_CPP_SPEC "%(netbsd_cpp_spec)" |
f5acdcc1 | 146 | |
f982f805 JT |
147 | /* Provide a LINK_SPEC appropriate for a NetBSD/mips target. |
148 | This is a copy of LINK_SPEC from <netbsd-elf.h> tweaked for | |
149 | the MIPS target. */ | |
f5acdcc1 | 150 | |
f982f805 | 151 | #undef LINK_SPEC |
1569d670 JT |
152 | #define LINK_SPEC \ |
153 | "%{EL:-m elf32lmip} \ | |
154 | %{EB:-m elf32bmip} \ | |
155 | %(endian_spec) \ | |
2d2a50c3 | 156 | %{G*} %{mips1} %{mips2} %{mips3} %{mips4} %{mips32} %{mips32r2} %{mips64} \ |
1569d670 JT |
157 | %{bestGnum} %{call_shared} %{no_archive} %{exact_version} \ |
158 | %(netbsd_link_spec)" | |
159 | ||
160 | #define NETBSD_ENTRY_POINT "__start" | |
f982f805 JT |
161 | |
162 | #undef SUBTARGET_ASM_SPEC | |
9f689d92 JT |
163 | #define SUBTARGET_ASM_SPEC \ |
164 | "%{!mno-abicalls: \ | |
165 | %{!fno-PIC:%{!fno-pic:-KPIC}}}" | |
f982f805 JT |
166 | |
167 | ||
168 | /* -G is incompatible with -KPIC which is the default, so only allow objects | |
169 | in the small data section if the user explicitly asks for it. */ | |
170 | ||
ce3649d2 EC |
171 | #undef MIPS_DEFAULT_GVALUE |
172 | #define MIPS_DEFAULT_GVALUE 0 | |
f982f805 JT |
173 | |
174 | ||
175 | /* This defines which switch letters take arguments. -G is a MIPS | |
176 | special. */ | |
177 | ||
178 | #undef SWITCH_TAKES_ARG | |
179 | #define SWITCH_TAKES_ARG(CHAR) \ | |
180 | (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ | |
181 | || (CHAR) == 'R' \ | |
182 | || (CHAR) == 'G') | |
f5acdcc1 | 183 | |
f5acdcc1 | 184 | |
f5acdcc1 | 185 | #undef ASM_FINAL_SPEC |
f982f805 JT |
186 | #undef SET_ASM_OP |
187 | ||
188 | ||
ac64a17c JT |
189 | /* NetBSD hasn't historically provided _flush_cache(), but rather |
190 | _cacheflush(), which takes the same arguments as the former. */ | |
191 | #undef CACHE_FLUSH_FUNC | |
192 | #define CACHE_FLUSH_FUNC "_cacheflush" | |
193 | ||
194 | ||
f982f805 JT |
195 | /* Make gcc agree with <machine/ansi.h> */ |
196 | ||
197 | #undef WCHAR_TYPE | |
198 | #define WCHAR_TYPE "int" | |
199 | ||
f982f805 JT |
200 | #undef WCHAR_TYPE_SIZE |
201 | #define WCHAR_TYPE_SIZE 32 | |
202 | ||
203 | #undef WINT_TYPE | |
204 | #define WINT_TYPE "int" |