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