1 /* Definitions of target machine for GNU compiler, for ELF on NetBSD/sparc
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)
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 #define TARGET_OS_CPP_BUILTINS() \
26 NETBSD_OS_CPP_BUILTINS_ELF(); \
29 NETBSD_OS_CPP_BUILTINS_LP64(); \
30 builtin_define ("__sparc64__"); \
31 builtin_define ("__sparc_v9__"); \
34 builtin_define ("__sparc"); \
35 builtin_define ("__sparc__"); \
39 /* Make sure these are undefined. */
41 #undef MD_STARTFILE_PREFIX
43 /* Make sure this is undefined. */
46 /* CPP defines used by all NetBSD targets. */
47 #undef CPP_SUBTARGET_SPEC
48 #define CPP_SUBTARGET_SPEC "%(netbsd_cpp_spec)"
50 /* SIZE_TYPE and PTRDIFF_TYPE are wrong from sparc/sparc.h. */
52 #define SIZE_TYPE "long unsigned int"
55 #define PTRDIFF_TYPE "long int"
57 #undef PREFERRED_DEBUGGING_TYPE
58 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
60 /* This is the char to use for continuation (in case we need to turn
61 continuation back on). */
62 #undef DBX_CONTIN_CHAR
63 #define DBX_CONTIN_CHAR '?'
65 #undef DBX_REGISTER_NUMBER
66 #define DBX_REGISTER_NUMBER(REGNO) \
67 (TARGET_FLAT && REGNO == HARD_FRAME_POINTER_REGNUM ? 31 : REGNO)
69 #undef LOCAL_LABEL_PREFIX
70 #define LOCAL_LABEL_PREFIX "."
72 /* This is how to output a definition of an internal numbered label where
73 PREFIX is the class of label and NUM is the number within the class. */
75 #undef ASM_OUTPUT_INTERNAL_LABEL
76 #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
77 fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
79 /* This is how to output a reference to an internal numbered label where
80 PREFIX is the class of label and NUM is the number within the class. */
82 #undef ASM_OUTPUT_INTERNAL_LABELREF
83 #define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
84 fprintf (FILE, ".L%s%d", PREFIX, NUM)
86 /* This is how to store into the string LABEL
87 the symbol_ref name of an internal numbered label where
88 PREFIX is the class of label and NUM is the number within the class.
89 This is suitable for output with `assemble_name'. */
91 #undef ASM_GENERATE_INTERNAL_LABEL
92 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
93 sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
95 #undef USER_LABEL_PREFIX
96 #define USER_LABEL_PREFIX ""
99 #define ASM_SPEC "%{fpic:-K PIC} %{fPIC:-K PIC} %{V} %{v:%{!V:-V}} \
100 %{mlittle-endian:-EL} \
101 %(asm_cpu) %(asm_arch) %(asm_relax)"
103 #undef STDC_0_IN_SYSTEM_HEADERS
105 #undef TARGET_VERSION
106 #define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
109 * Clean up afterwards generic SPARC ELF configuration.
112 /* FIXME: Aren't these supposed to be available for SPARC ELF? */
113 #undef MULDI3_LIBCALL
114 #undef DIVDI3_LIBCALL
115 #undef UDIVDI3_LIBCALL
116 #undef MODDI3_LIBCALL
117 #undef UMODDI3_LIBCALL
118 #undef INIT_SUBTARGET_OPTABS
119 #define INIT_SUBTARGET_OPTABS
121 /* Below here exists the merged NetBSD/sparc & NetBSD/sparc64 compiler
122 description, allowing one to build 32 bit or 64 bit applications
123 on either. We define the sparc & sparc64 versions of things,
124 occasionally a neutral version (should be the same as "netbsd-elf.h")
125 and then based on SPARC_BI_ARCH, DEFAULT_ARCH32_P, and TARGET_CPU_DEFAULT,
126 we choose the correct version. */
128 /* We use the default NetBSD ELF STARTFILE_SPEC and ENDFILE_SPEC
129 definitions, even for the SPARC_BI_ARCH compiler, because NetBSD does
130 not have a default place to find these libraries.. */
132 /* Name the port(s). */
133 #define TARGET_NAME64 "NetBSD/sparc64 ELF"
134 #define TARGET_NAME32 "NetBSD/sparc ELF"
136 /* TARGET_CPU_DEFAULT is set in Makefile.in. We test for 64-bit default
139 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
140 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
141 /* A 64 bit v9 compiler with stack-bias,
142 in a Medium/Low code model environment. */
144 #undef TARGET_DEFAULT
145 #define TARGET_DEFAULT \
146 (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
147 + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
149 #undef SPARC_DEFAULT_CMODEL
150 #define SPARC_DEFAULT_CMODEL CM_MEDANY
154 /* CC1_SPEC for NetBSD/sparc. */
156 "%{sun4:} %{target:} \
157 %{mcypress:-mcpu=cypress} \
158 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
159 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
160 %{m32:%{m64:%emay not use both -m32 and -m64}} \
162 -mptr64 -mstack-bias -mno-v8plus -mlong-double-128 \
169 %{!msupersparc:-mcpu=ultrasparc}}}}}}} \
170 %{!mno-vis:%{!mcpu=v9:-mvis}} \
171 %{p:-mcmodel=medlow} \
172 %{pg:-mcmodel=medlow}}"
175 "%{sun4:} %{target:} \
176 %{mcypress:-mcpu=cypress} \
177 %{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
178 %{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
179 %{m32:%{m64:%emay not use both -m32 and -m64}} \
181 -mptr32 -mno-stack-bias \
182 %{!mlong-double-128:-mlong-double-64} \
189 %{!msupersparc:-mcpu=cypress}}}}}}}} \
191 %{p:-mcmodel=medlow} \
192 %{pg:-mcmodel=medlow}}"
194 /* Make sure we use the right output format. Pick a default and then
195 make sure -m32/-m64 switch to the right one. */
197 #define LINK_ARCH32_SPEC "-m elf32_sparc"
199 #define LINK_ARCH64_SPEC "-m elf64_sparc"
201 #define LINK_ARCH_SPEC \
202 "%{m32:%(link_arch32)} \
203 %{m64:%(link_arch64)} \
204 %{!m32:%{!m64:%(link_arch_default)}}"
209 %{!mno-relax:%{!r:-relax}} \
212 #define NETBSD_ENTRY_POINT "__start"
215 #define LINK_ARCH_DEFAULT_SPEC LINK_ARCH32_SPEC
217 #define LINK_ARCH_DEFAULT_SPEC LINK_ARCH64_SPEC
220 /* What extra spec entries do we need? */
221 #undef SUBTARGET_EXTRA_SPECS
222 #define SUBTARGET_EXTRA_SPECS \
223 { "link_arch32", LINK_ARCH32_SPEC }, \
224 { "link_arch64", LINK_ARCH64_SPEC }, \
225 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
226 { "link_arch", LINK_ARCH_SPEC }, \
227 { "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
228 { "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
229 { "netbsd_entry_point", NETBSD_ENTRY_POINT },
232 /* What extra switches do we need? */
233 #undef SUBTARGET_SWITCHES
234 #define SUBTARGET_SWITCHES \
235 {"long-double-64", -MASK_LONG_DOUBLE_128, N_("Use 64 bit long doubles") }, \
236 {"long-double-128", MASK_LONG_DOUBLE_128, N_("Use 128 bit long doubles") },
239 /* Build a compiler that supports -m32 and -m64? */
243 #undef LONG_DOUBLE_TYPE_SIZE
244 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
246 #undef MAX_LONG_DOUBLE_TYPE_SIZE
247 #define MAX_LONG_DOUBLE_TYPE_SIZE 128
249 #if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
250 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
252 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
257 #define CC1_SPEC CC1_SPEC32
259 #define CC1_SPEC CC1_SPEC64
263 #define MULTILIB_DEFAULTS { "m32" }
265 #define MULTILIB_DEFAULTS { "m64" }
270 #define TARGET_NAME (DEFAULT_ARCH32_P ? TARGET_NAME32 : TARGET_NAME64)
272 #else /* SPARC_BI_ARCH */
274 #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
275 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
277 #undef LONG_DOUBLE_TYPE_SIZE
278 #define LONG_DOUBLE_TYPE_SIZE 128
280 #undef MAX_LONG_DOUBLE_TYPE_SIZE
281 #define MAX_LONG_DOUBLE_TYPE_SIZE 128
283 #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
284 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
287 #define CC1_SPEC CC1_SPEC64
290 #define TARGET_NAME TARGET_NAME64
292 #else /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
293 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
295 /* A 32-bit only compiler. NetBSD don't support 128 bit `long double'
296 for 32-bit code, unlike Solaris. */
298 #undef LONG_DOUBLE_TYPE_SIZE
299 #define LONG_DOUBLE_TYPE_SIZE 64
301 #undef MAX_LONG_DOUBLE_TYPE_SIZE
302 #define MAX_LONG_DOUBLE_TYPE_SIZE 64
304 #undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
305 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
308 #define CC1_SPEC CC1_SPEC32
311 #define TARGET_NAME TARGET_NAME32
313 #endif /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
314 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
316 #endif /* SPARC_BI_ARCH */
318 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
319 #undef CTORS_SECTION_ASM_OP
320 #undef DTORS_SECTION_ASM_OP