* config/sparc/netbsd-elf.c (CPP_SUBTARGET_SPEC64): Remove
[official-gcc.git] / gcc / config / sparc / netbsd-elf.h
blob1bf4356b5cac978877dde3b83db82d15150d2e9f
1 /* Definitions of target machine for GNU compiler, for ELF on NetBSD/sparc
2 and NetBSD/sparc64.
3 Copyright (C) 2002 Free Software Foundation, Inc.
4 Contributed by Matthew Green (mrg@eterna.com.au).
6 This file is part of GNU CC.
8 GNU CC 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.
13 GNU CC 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.
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING. If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
23 /* Make sure these are undefined. */
24 #undef MD_EXEC_PREFIX
25 #undef MD_STARTFILE_PREFIX
27 #undef CPP_PREDEFINES
28 #define CPP_PREDEFINES "-D__sparc__ -D__NetBSD__ -D__ELF__ \
29 -Asystem=unix -Asystem=NetBSD"
31 /* CPP defines used for 64 bit code. */
32 #undef CPP_SUBTARGET_SPEC64
33 #define CPP_SUBTARGET_SPEC64 \
34 "-D__sparc64__ -D__sparc_v9__ -D_LP64 %{posix:-D_POSIX_SOURCE}"
36 /* CPP defines used for 32 bit code. */
37 #undef CPP_SUBTARGET_SPEC32
38 #define CPP_SUBTARGET_SPEC32 "-D__sparc %{posix:-D_POSIX_SOURCE}"
40 /* CPP_ARCH32_SPEC and CPP_ARCH64_SPEC are wrong from sparc/sparc.h; we
41 always want the non-SPARC_BI_ARCH versions, since the SPARC_BI_ARCH
42 versions define __SIZE_TYPE__ and __PTRDIFF_TYPE__ incorrectly for
43 NetBSD. */
44 #undef CPP_ARCH32_SPEC
45 #define CPP_ARCH32_SPEC "-D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc"
47 #undef CPP_ARCH64_SPEC
48 #define CPP_ARCH64_SPEC "-D__arch64__ -Acpu=sparc64 -Amachine=sparc64"
50 /* sparc/sparc.h defines NO_BUILTIN_SIZE_TYPE and NO_BUILTIN_PTRDIFF_TYPE
51 if SPARC_BI_ARCH is defined. This is wrong for NetBSD; size_t and
52 ptrdiff_t do not change for 32-bit vs. 64-bit. */
53 #undef NO_BUILTIN_PTRDIFF_TYPE
54 #undef NO_BUILTIN_SIZE_TYPE
56 /* SIZE_TYPE and PTRDIFF_TYPE are wrong from sparc/sparc.h. */
57 #undef SIZE_TYPE
58 #define SIZE_TYPE "long unsigned int"
60 #undef PTRDIFF_TYPE
61 #define PTRDIFF_TYPE "long int"
63 #undef PREFERRED_DEBUGGING_TYPE
64 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
66 /* This is the char to use for continuation (in case we need to turn
67 continuation back on). */
68 #undef DBX_CONTIN_CHAR
69 #define DBX_CONTIN_CHAR '?'
71 #undef DBX_REGISTER_NUMBER
72 #define DBX_REGISTER_NUMBER(REGNO) \
73 (TARGET_FLAT && REGNO == HARD_FRAME_POINTER_REGNUM ? 31 : REGNO)
75 #undef LOCAL_LABEL_PREFIX
76 #define LOCAL_LABEL_PREFIX "."
78 /* This is how to output a definition of an internal numbered label where
79 PREFIX is the class of label and NUM is the number within the class. */
81 #undef ASM_OUTPUT_INTERNAL_LABEL
82 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
83 fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
85 /* This is how to output a reference to an internal numbered label where
86 PREFIX is the class of label and NUM is the number within the class. */
88 #undef ASM_OUTPUT_INTERNAL_LABELREF
89 #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
90 fprintf (FILE, ".L%s%d", PREFIX, NUM)
92 /* This is how to store into the string LABEL
93 the symbol_ref name of an internal numbered label where
94 PREFIX is the class of label and NUM is the number within the class.
95 This is suitable for output with `assemble_name'. */
97 #undef ASM_GENERATE_INTERNAL_LABEL
98 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
99 sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
101 #undef USER_LABEL_PREFIX
102 #define USER_LABEL_PREFIX ""
104 #undef ASM_SPEC
105 #define ASM_SPEC "%{fpic:-K PIC} %{fPIC:-K PIC} %{V} %{v:%{!V:-V}} \
106 %{mlittle-endian:-EL} \
107 %(asm_cpu) %(asm_arch) %(asm_relax)"
109 #undef STDC_0_IN_SYSTEM_HEADERS
111 #undef TARGET_VERSION
112 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
115 * Clean up afterwards generic SPARC ELF configuration.
118 #undef TRANSFER_FROM_TRAMPOLINE
119 #define TRANSFER_FROM_TRAMPOLINE
121 /* FIXME: Aren't these supposed to be available for SPARC ELF? */
122 #undef MULDI3_LIBCALL
123 #undef DIVDI3_LIBCALL
124 #undef UDIVDI3_LIBCALL
125 #undef MODDI3_LIBCALL
126 #undef UMODDI3_LIBCALL
127 #undef INIT_SUBTARGET_OPTABS
128 #define INIT_SUBTARGET_OPTABS
130 /* Below here exists the merged NetBSD/sparc & NetBSD/sparc64 compiler
131 description, allowing one to build 32 bit or 64 bit applications
132 on either. We define the sparc & sparc64 versions of things,
133 occasionally a neutral version (should be the same as "netbsd-elf.h")
134 and then based on SPARC_BI_ARCH, DEFAULT_ARCH32_P, and TARGET_CPU_DEFAULT,
135 we choose the correct version. */
137 /* We use the default NetBSD ELF STARTFILE_SPEC and ENDFILE_SPEC
138 definitions, even for the SPARC_BI_ARCH compiler, because NetBSD does
139 not have a default place to find these libraries.. */
141 /* Name the port(s). */
142 #define TARGET_NAME64 "NetBSD/sparc64 ELF"
143 #define TARGET_NAME32 "NetBSD/sparc ELF"
145 /* TARGET_CPU_DEFAULT is set in Makefile.in. We test for 64-bit default
146 platform here. */
148 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
149 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
150 /* A 64 bit v9 compiler with stack-bias,
151 in a Medium/Low code model environment. */
153 #undef TARGET_DEFAULT
154 #define TARGET_DEFAULT \
155 (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
156 + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
158 #undef SPARC_DEFAULT_CMODEL
159 #define SPARC_DEFAULT_CMODEL CM_MEDANY
161 #endif
163 /* CC1_SPEC for NetBSD/sparc. */
164 #define CC1_SPEC32 \
165 "%{sun4:} %{target:} \
166 %{mcypress:-mcpu=cypress} \
167 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
168 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
169 %{m32:%{m64:%emay not use both -m32 and -m64}} \
170 %{m64: \
171 -mptr64 -mstack-bias -mno-v8plus -mlong-double-128 \
172 %{!mcpu*: \
173 %{!mcypress: \
174 %{!msparclite: \
175 %{!mf930: \
176 %{!mf934: \
177 %{!mv8*: \
178 %{!msupersparc:-mcpu=ultrasparc}}}}}}} \
179 %{!mno-vis:%{!mcpu=v9:-mvis}} \
180 %{p:-mcmodel=medlow} \
181 %{pg:-mcmodel=medlow}}"
183 #define CC1_SPEC64 \
184 "%{sun4:} %{target:} \
185 %{mcypress:-mcpu=cypress} \
186 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
187 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
188 %{m32:%{m64:%emay not use both -m32 and -m64}} \
189 %{m32: \
190 -mptr32 -mno-stack-bias \
191 %{!mlong-double-128:-mlong-double-64} \
192 %{!mcpu*: \
193 %{!mcypress: \
194 %{!msparclite: \
195 %{!mf930: \
196 %{!mf934: \
197 %{!mv8*: \
198 %{!msupersparc:-mcpu=cypress}}}}}}}} \
199 %{!m32: \
200 %{p:-mcmodel=medlow} \
201 %{pg:-mcmodel=medlow}}"
203 /* Make sure we use the right output format. Pick a default and then
204 make sure -m32/-m64 switch to the right one. */
206 #define LINK_ARCH32_SPEC \
207 "%-m elf32_sparc \
208 %{assert*} %{R*} %{V} %{v:%{!V:-V}} \
209 %{shared:-shared} \
210 %{!shared: \
211 -dp \
212 %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
213 %{!static: \
214 -dy %{rdynamic:-export-dynamic} \
215 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
216 %{static:-static}}"
218 #define LINK_ARCH64_SPEC \
219 "%-m elf64_sparc \
220 %{assert*} %{R*} %{V} %{v:%{!V:-V}} \
221 %{shared:-shared} \
222 %{!shared: \
223 -dp \
224 %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
225 %{!static: \
226 -dy %{rdynamic:-export-dynamic} \
227 %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
228 %{static:-static}}"
230 #define LINK_ARCH_SPEC "\
231 %{m32:%(link_arch32)} \
232 %{m64:%(link_arch64)} \
233 %{!m32:%{!m64:%(link_arch_default)}} \
236 #if DEFAULT_ARCH32_P
237 #define LINK_ARCH_DEFAULT_SPEC LINK_ARCH32_SPEC
238 #else
239 #define LINK_ARCH_DEFAULT_SPEC LINK_ARCH64_SPEC
240 #endif
242 /* What extra spec entries do we need? */
243 #undef SUBTARGET_EXTRA_SPECS
244 #define SUBTARGET_EXTRA_SPECS \
245 { "link_arch32", LINK_ARCH32_SPEC }, \
246 { "link_arch64", LINK_ARCH64_SPEC }, \
247 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
248 { "link_arch", LINK_ARCH_SPEC }, \
249 { "cpp_subtarget_spec32", CPP_SUBTARGET_SPEC32 }, \
250 { "cpp_subtarget_spec64", CPP_SUBTARGET_SPEC64 },
253 /* What extra switches do we need? */
254 #undef SUBTARGET_SWITCHES
255 #define SUBTARGET_SWITCHES \
256 {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \
257 {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") },
260 /* Build a compiler that supports -m32 and -m64? */
262 #ifdef SPARC_BI_ARCH
264 #undef LONG_DOUBLE_TYPE_SIZE
265 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
267 #undef MAX_LONG_DOUBLE_TYPE_SIZE
268 #define MAX_LONG_DOUBLE_TYPE_SIZE 128
270 #if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
271 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
272 #else
273 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
274 #endif
276 #undef CC1_SPEC
277 #if DEFAULT_ARCH32_P
278 #define CC1_SPEC CC1_SPEC32
279 #else
280 #define CC1_SPEC CC1_SPEC64
281 #endif
283 #if DEFAULT_ARCH32_P
284 #define MULTILIB_DEFAULTS { "m32" }
285 #else
286 #define MULTILIB_DEFAULTS { "m64" }
287 #endif
289 #undef CPP_SUBTARGET_SPEC
290 #if DEFAULT_ARCH32_P
291 #define CPP_SUBTARGET_SPEC \
292 "%{m64:%(cpp_subtarget_spec64)}%{!m64:%(cpp_subtarget_spec32)}"
293 #else
294 #define CPP_SUBTARGET_SPEC \
295 "%{!m32:%(cpp_subtarget_spec64)}%{m32:%(cpp_subtarget_spec32)}"
296 #endif
298 /* Restore this from sparc/sparc.h, netbsd.h changes it. */
299 #undef CPP_SPEC
300 #define CPP_SPEC "%(cpp_cpu) %(cpp_arch) %(cpp_endian) %(cpp_subtarget)"
302 /* Name the port. */
303 #undef TARGET_NAME
304 #define TARGET_NAME (DEFAULT_ARCH32_P ? TARGET_NAME32 : TARGET_NAME64)
306 #else /* SPARC_BI_ARCH */
308 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
309 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
311 #undef LONG_DOUBLE_TYPE_SIZE
312 #define LONG_DOUBLE_TYPE_SIZE 128
314 #undef MAX_LONG_DOUBLE_TYPE_SIZE
315 #define MAX_LONG_DOUBLE_TYPE_SIZE 128
317 #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
318 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
320 #undef CC1_SPEC
321 #define CC1_SPEC CC1_SPEC64
323 #undef CPP_SUBTARGET_SPEC
324 #define CPP_SUBTARGET_SPEC CPP_SUBTARGET_SPEC64
326 #undef TARGET_NAME
327 #define TARGET_NAME TARGET_NAME64
329 #else /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
330 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
332 /* A 32-bit only compiler. NetBSD don't support 128 bit `long double'
333 for 32-bit code, unlike Solaris. */
335 #undef LONG_DOUBLE_TYPE_SIZE
336 #define LONG_DOUBLE_TYPE_SIZE 64
338 #undef MAX_LONG_DOUBLE_TYPE_SIZE
339 #define MAX_LONG_DOUBLE_TYPE_SIZE 64
341 #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
342 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
344 #undef CPP_SUBTARGET_SPEC
345 #define CPP_SUBTARGET_SPEC CPP_SUBTARGET_SPEC32
347 #undef CC1_SPEC
348 #define CC1_SPEC CC1_SPEC32
350 #undef TARGET_NAME
351 #define TARGET_NAME TARGET_NAME32
353 #endif /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
354 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
356 #endif /* SPARC_BI_ARCH */
358 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
359 #undef CTORS_SECTION_ASM_OP
360 #undef DTORS_SECTION_ASM_OP