1 |
12 |
jlechner |
/* Definitions of target machine for GCC, for ELF on NetBSD/sparc
|
2 |
|
|
and NetBSD/sparc64.
|
3 |
|
|
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
4 |
|
|
Contributed by Matthew Green (mrg@eterna.com.au).
|
5 |
|
|
|
6 |
|
|
This file is part of GCC.
|
7 |
|
|
|
8 |
|
|
GCC is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
11 |
|
|
any later version.
|
12 |
|
|
|
13 |
|
|
GCC is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with GCC; see the file COPYING. If not, write to
|
20 |
|
|
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
21 |
|
|
Boston, MA 02110-1301, USA. */
|
22 |
|
|
|
23 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
24 |
|
|
do \
|
25 |
|
|
{ \
|
26 |
|
|
NETBSD_OS_CPP_BUILTINS_ELF(); \
|
27 |
|
|
if (TARGET_ARCH64) \
|
28 |
|
|
{ \
|
29 |
|
|
builtin_define ("__sparc64__"); \
|
30 |
|
|
builtin_define ("__sparc_v9__"); \
|
31 |
|
|
builtin_define ("__sparcv9"); \
|
32 |
|
|
} \
|
33 |
|
|
else \
|
34 |
|
|
builtin_define ("__sparc"); \
|
35 |
|
|
builtin_define ("__sparc__"); \
|
36 |
|
|
} \
|
37 |
|
|
while (0)
|
38 |
|
|
|
39 |
|
|
/* Make sure these are undefined. */
|
40 |
|
|
#undef MD_EXEC_PREFIX
|
41 |
|
|
#undef MD_STARTFILE_PREFIX
|
42 |
|
|
|
43 |
|
|
/* CPP defines used by all NetBSD targets. */
|
44 |
|
|
#undef CPP_SUBTARGET_SPEC
|
45 |
|
|
#define CPP_SUBTARGET_SPEC "%(netbsd_cpp_spec)"
|
46 |
|
|
|
47 |
|
|
/* SIZE_TYPE and PTRDIFF_TYPE are wrong from sparc/sparc.h. */
|
48 |
|
|
#undef SIZE_TYPE
|
49 |
|
|
#define SIZE_TYPE "long unsigned int"
|
50 |
|
|
|
51 |
|
|
#undef PTRDIFF_TYPE
|
52 |
|
|
#define PTRDIFF_TYPE "long int"
|
53 |
|
|
|
54 |
|
|
/* This is the char to use for continuation (in case we need to turn
|
55 |
|
|
continuation back on). */
|
56 |
|
|
#undef DBX_CONTIN_CHAR
|
57 |
|
|
#define DBX_CONTIN_CHAR '?'
|
58 |
|
|
|
59 |
|
|
#undef LOCAL_LABEL_PREFIX
|
60 |
|
|
#define LOCAL_LABEL_PREFIX "."
|
61 |
|
|
|
62 |
|
|
/* This is how to store into the string LABEL
|
63 |
|
|
the symbol_ref name of an internal numbered label where
|
64 |
|
|
PREFIX is the class of label and NUM is the number within the class.
|
65 |
|
|
This is suitable for output with `assemble_name'. */
|
66 |
|
|
|
67 |
|
|
#undef ASM_GENERATE_INTERNAL_LABEL
|
68 |
|
|
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
69 |
|
|
sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
|
70 |
|
|
|
71 |
|
|
#undef USER_LABEL_PREFIX
|
72 |
|
|
#define USER_LABEL_PREFIX ""
|
73 |
|
|
|
74 |
|
|
#undef ASM_SPEC
|
75 |
|
|
#define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} %{V} %{v:%{!V:-V}} \
|
76 |
|
|
%{mlittle-endian:-EL} \
|
77 |
|
|
%(asm_cpu) %(asm_arch) %(asm_relax)"
|
78 |
|
|
|
79 |
|
|
#undef STDC_0_IN_SYSTEM_HEADERS
|
80 |
|
|
|
81 |
|
|
/* Attempt to enable execute permissions on the stack. */
|
82 |
|
|
#define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
|
83 |
|
|
|
84 |
|
|
#undef TARGET_VERSION
|
85 |
|
|
#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
|
86 |
|
|
|
87 |
|
|
/* Below here exists the merged NetBSD/sparc & NetBSD/sparc64 compiler
|
88 |
|
|
description, allowing one to build 32 bit or 64 bit applications
|
89 |
|
|
on either. We define the sparc & sparc64 versions of things,
|
90 |
|
|
occasionally a neutral version (should be the same as "netbsd-elf.h")
|
91 |
|
|
and then based on SPARC_BI_ARCH, DEFAULT_ARCH32_P, and TARGET_CPU_DEFAULT,
|
92 |
|
|
we choose the correct version. */
|
93 |
|
|
|
94 |
|
|
/* We use the default NetBSD ELF STARTFILE_SPEC and ENDFILE_SPEC
|
95 |
|
|
definitions, even for the SPARC_BI_ARCH compiler, because NetBSD does
|
96 |
|
|
not have a default place to find these libraries.. */
|
97 |
|
|
|
98 |
|
|
/* Name the port(s). */
|
99 |
|
|
#define TARGET_NAME64 "NetBSD/sparc64 ELF"
|
100 |
|
|
#define TARGET_NAME32 "NetBSD/sparc ELF"
|
101 |
|
|
|
102 |
|
|
/* TARGET_CPU_DEFAULT is set in Makefile.in. We test for 64-bit default
|
103 |
|
|
platform here. */
|
104 |
|
|
|
105 |
|
|
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
106 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
|
107 |
|
|
/* A 64 bit v9 compiler with stack-bias,
|
108 |
|
|
in a Medium/Low code model environment. */
|
109 |
|
|
|
110 |
|
|
#undef TARGET_DEFAULT
|
111 |
|
|
#define TARGET_DEFAULT \
|
112 |
|
|
(MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
|
113 |
|
|
+ MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
|
114 |
|
|
|
115 |
|
|
#undef SPARC_DEFAULT_CMODEL
|
116 |
|
|
#define SPARC_DEFAULT_CMODEL CM_MEDANY
|
117 |
|
|
|
118 |
|
|
#endif
|
119 |
|
|
|
120 |
|
|
/* CC1_SPEC for NetBSD/sparc. */
|
121 |
|
|
#define CC1_SPEC32 \
|
122 |
|
|
"%{sun4:} %{target:} \
|
123 |
|
|
%{mcypress:-mcpu=cypress} \
|
124 |
|
|
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
125 |
|
|
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
126 |
|
|
%{m32:%{m64:%emay not use both -m32 and -m64}} \
|
127 |
|
|
%{m64: \
|
128 |
|
|
-mptr64 -mstack-bias -mno-v8plus -mlong-double-128 \
|
129 |
|
|
%{!mcpu*: \
|
130 |
|
|
%{!mcypress: \
|
131 |
|
|
%{!msparclite: \
|
132 |
|
|
%{!mf930: \
|
133 |
|
|
%{!mf934: \
|
134 |
|
|
%{!mv8*: \
|
135 |
|
|
%{!msupersparc:-mcpu=ultrasparc}}}}}}} \
|
136 |
|
|
%{!mno-vis:%{!mcpu=v9:-mvis}} \
|
137 |
|
|
%{p:-mcmodel=medlow} \
|
138 |
|
|
%{pg:-mcmodel=medlow}}"
|
139 |
|
|
|
140 |
|
|
#define CC1_SPEC64 \
|
141 |
|
|
"%{sun4:} %{target:} \
|
142 |
|
|
%{mcypress:-mcpu=cypress} \
|
143 |
|
|
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
144 |
|
|
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
145 |
|
|
%{m32:%{m64:%emay not use both -m32 and -m64}} \
|
146 |
|
|
%{m32: \
|
147 |
|
|
-mptr32 -mno-stack-bias \
|
148 |
|
|
%{!mlong-double-128:-mlong-double-64} \
|
149 |
|
|
%{!mcpu*: \
|
150 |
|
|
%{!mcypress: \
|
151 |
|
|
%{!msparclite: \
|
152 |
|
|
%{!mf930: \
|
153 |
|
|
%{!mf934: \
|
154 |
|
|
%{!mv8*: \
|
155 |
|
|
%{!msupersparc:-mcpu=cypress}}}}}}}} \
|
156 |
|
|
%{!m32: \
|
157 |
|
|
%{p:-mcmodel=medlow} \
|
158 |
|
|
%{pg:-mcmodel=medlow}}"
|
159 |
|
|
|
160 |
|
|
/* Make sure we use the right output format. Pick a default and then
|
161 |
|
|
make sure -m32/-m64 switch to the right one. */
|
162 |
|
|
|
163 |
|
|
#define LINK_ARCH32_SPEC "-m elf32_sparc"
|
164 |
|
|
|
165 |
|
|
#define LINK_ARCH64_SPEC "-m elf64_sparc"
|
166 |
|
|
|
167 |
|
|
#define LINK_ARCH_SPEC \
|
168 |
|
|
"%{m32:%(link_arch32)} \
|
169 |
|
|
%{m64:%(link_arch64)} \
|
170 |
|
|
%{!m32:%{!m64:%(link_arch_default)}}"
|
171 |
|
|
|
172 |
|
|
#undef LINK_SPEC
|
173 |
|
|
#define LINK_SPEC \
|
174 |
|
|
"%(link_arch) \
|
175 |
|
|
%{!mno-relax:%{!r:-relax}} \
|
176 |
|
|
%(netbsd_link_spec)"
|
177 |
|
|
|
178 |
|
|
#define NETBSD_ENTRY_POINT "__start"
|
179 |
|
|
|
180 |
|
|
#if DEFAULT_ARCH32_P
|
181 |
|
|
#define LINK_ARCH_DEFAULT_SPEC LINK_ARCH32_SPEC
|
182 |
|
|
#else
|
183 |
|
|
#define LINK_ARCH_DEFAULT_SPEC LINK_ARCH64_SPEC
|
184 |
|
|
#endif
|
185 |
|
|
|
186 |
|
|
/* What extra spec entries do we need? */
|
187 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
188 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
189 |
|
|
{ "link_arch32", LINK_ARCH32_SPEC }, \
|
190 |
|
|
{ "link_arch64", LINK_ARCH64_SPEC }, \
|
191 |
|
|
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
|
192 |
|
|
{ "link_arch", LINK_ARCH_SPEC }, \
|
193 |
|
|
{ "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
|
194 |
|
|
{ "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
|
195 |
|
|
{ "netbsd_entry_point", NETBSD_ENTRY_POINT },
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
/* Build a compiler that supports -m32 and -m64? */
|
199 |
|
|
|
200 |
|
|
#ifdef SPARC_BI_ARCH
|
201 |
|
|
|
202 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
203 |
|
|
#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
|
204 |
|
|
|
205 |
|
|
#if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
|
206 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
|
207 |
|
|
#else
|
208 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
209 |
|
|
#endif
|
210 |
|
|
|
211 |
|
|
#undef CC1_SPEC
|
212 |
|
|
#if DEFAULT_ARCH32_P
|
213 |
|
|
#define CC1_SPEC CC1_SPEC32
|
214 |
|
|
#else
|
215 |
|
|
#define CC1_SPEC CC1_SPEC64
|
216 |
|
|
#endif
|
217 |
|
|
|
218 |
|
|
#if DEFAULT_ARCH32_P
|
219 |
|
|
#define MULTILIB_DEFAULTS { "m32" }
|
220 |
|
|
#else
|
221 |
|
|
#define MULTILIB_DEFAULTS { "m64" }
|
222 |
|
|
#endif
|
223 |
|
|
|
224 |
|
|
/* Name the port. */
|
225 |
|
|
#undef TARGET_NAME
|
226 |
|
|
#define TARGET_NAME (DEFAULT_ARCH32_P ? TARGET_NAME32 : TARGET_NAME64)
|
227 |
|
|
|
228 |
|
|
#else /* SPARC_BI_ARCH */
|
229 |
|
|
|
230 |
|
|
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
231 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
|
232 |
|
|
|
233 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
234 |
|
|
#define LONG_DOUBLE_TYPE_SIZE 128
|
235 |
|
|
|
236 |
|
|
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
|
237 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
|
238 |
|
|
|
239 |
|
|
#undef CC1_SPEC
|
240 |
|
|
#define CC1_SPEC CC1_SPEC64
|
241 |
|
|
|
242 |
|
|
#undef TARGET_NAME
|
243 |
|
|
#define TARGET_NAME TARGET_NAME64
|
244 |
|
|
|
245 |
|
|
#else /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
246 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
|
247 |
|
|
|
248 |
|
|
/* A 32-bit only compiler. NetBSD don't support 128 bit `long double'
|
249 |
|
|
for 32-bit code, unlike Solaris. */
|
250 |
|
|
|
251 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
252 |
|
|
#define LONG_DOUBLE_TYPE_SIZE 64
|
253 |
|
|
|
254 |
|
|
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
|
255 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
256 |
|
|
|
257 |
|
|
#undef CC1_SPEC
|
258 |
|
|
#define CC1_SPEC CC1_SPEC32
|
259 |
|
|
|
260 |
|
|
#undef TARGET_NAME
|
261 |
|
|
#define TARGET_NAME TARGET_NAME32
|
262 |
|
|
|
263 |
|
|
#endif /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
264 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
|
265 |
|
|
|
266 |
|
|
#endif /* SPARC_BI_ARCH */
|
267 |
|
|
|
268 |
|
|
/* We use GNU ld so undefine this so that attribute((init_priority)) works. */
|
269 |
|
|
#undef CTORS_SECTION_ASM_OP
|
270 |
|
|
#undef DTORS_SECTION_ASM_OP
|