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