1 |
709 |
jeremybenn |
/* Definitions of target machine for GCC, for ELF on NetBSD/sparc
|
2 |
|
|
and NetBSD/sparc64.
|
3 |
|
|
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2010, 2011
|
4 |
|
|
Free Software Foundation, Inc.
|
5 |
|
|
Contributed by Matthew Green (mrg@eterna.com.au).
|
6 |
|
|
|
7 |
|
|
This file is part of GCC.
|
8 |
|
|
|
9 |
|
|
GCC is free software; you can redistribute it and/or modify
|
10 |
|
|
it under the terms of the GNU General Public License as published by
|
11 |
|
|
the Free Software Foundation; either version 3, or (at your option)
|
12 |
|
|
any later version.
|
13 |
|
|
|
14 |
|
|
GCC is distributed in the hope that it will be useful,
|
15 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
|
|
GNU General Public License for more details.
|
18 |
|
|
|
19 |
|
|
You should have received a copy of the GNU General Public License
|
20 |
|
|
along with GCC; see the file COPYING3. If not see
|
21 |
|
|
<http://www.gnu.org/licenses/>. */
|
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 |
|
|
/* CPP defines used by all NetBSD targets. */
|
40 |
|
|
#undef CPP_SUBTARGET_SPEC
|
41 |
|
|
#define CPP_SUBTARGET_SPEC "%(netbsd_cpp_spec)"
|
42 |
|
|
|
43 |
|
|
/* SIZE_TYPE and PTRDIFF_TYPE are wrong from sparc/sparc.h. */
|
44 |
|
|
#undef SIZE_TYPE
|
45 |
|
|
#define SIZE_TYPE "long unsigned int"
|
46 |
|
|
|
47 |
|
|
#undef PTRDIFF_TYPE
|
48 |
|
|
#define PTRDIFF_TYPE "long int"
|
49 |
|
|
|
50 |
|
|
/* This is the char to use for continuation (in case we need to turn
|
51 |
|
|
continuation back on). */
|
52 |
|
|
#undef DBX_CONTIN_CHAR
|
53 |
|
|
#define DBX_CONTIN_CHAR '?'
|
54 |
|
|
|
55 |
|
|
#undef LOCAL_LABEL_PREFIX
|
56 |
|
|
#define LOCAL_LABEL_PREFIX "."
|
57 |
|
|
|
58 |
|
|
/* This is how to store into the string LABEL
|
59 |
|
|
the symbol_ref name of an internal numbered label where
|
60 |
|
|
PREFIX is the class of label and NUM is the number within the class.
|
61 |
|
|
This is suitable for output with `assemble_name'. */
|
62 |
|
|
|
63 |
|
|
#undef ASM_GENERATE_INTERNAL_LABEL
|
64 |
|
|
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
65 |
|
|
sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM))
|
66 |
|
|
|
67 |
|
|
#undef USER_LABEL_PREFIX
|
68 |
|
|
#define USER_LABEL_PREFIX ""
|
69 |
|
|
|
70 |
|
|
#undef ASM_SPEC
|
71 |
|
|
#define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} \
|
72 |
|
|
%(asm_cpu) %(asm_arch) %(asm_relax)"
|
73 |
|
|
|
74 |
|
|
#undef STDC_0_IN_SYSTEM_HEADERS
|
75 |
|
|
|
76 |
|
|
#define HAVE_ENABLE_EXECUTE_STACK
|
77 |
|
|
|
78 |
|
|
/* Below here exists the merged NetBSD/sparc & NetBSD/sparc64 compiler
|
79 |
|
|
description, allowing one to build 32-bit or 64-bit applications
|
80 |
|
|
on either. We define the sparc & sparc64 versions of things,
|
81 |
|
|
occasionally a neutral version (should be the same as "netbsd-elf.h")
|
82 |
|
|
and then based on SPARC_BI_ARCH, DEFAULT_ARCH32_P, and TARGET_CPU_DEFAULT,
|
83 |
|
|
we choose the correct version. */
|
84 |
|
|
|
85 |
|
|
/* We use the default NetBSD ELF STARTFILE_SPEC and ENDFILE_SPEC
|
86 |
|
|
definitions, even for the SPARC_BI_ARCH compiler, because NetBSD does
|
87 |
|
|
not have a default place to find these libraries.. */
|
88 |
|
|
|
89 |
|
|
/* TARGET_CPU_DEFAULT is set in Makefile.in. We test for 64-bit default
|
90 |
|
|
platform here. */
|
91 |
|
|
|
92 |
|
|
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
93 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
|
94 |
|
|
/* A 64 bit v9 compiler with stack-bias,
|
95 |
|
|
in a Medium/Low code model environment. */
|
96 |
|
|
|
97 |
|
|
#undef TARGET_DEFAULT
|
98 |
|
|
#define TARGET_DEFAULT \
|
99 |
|
|
(MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
|
100 |
|
|
+ MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
|
101 |
|
|
|
102 |
|
|
#undef SPARC_DEFAULT_CMODEL
|
103 |
|
|
#define SPARC_DEFAULT_CMODEL CM_MEDANY
|
104 |
|
|
|
105 |
|
|
#endif
|
106 |
|
|
|
107 |
|
|
/* CC1_SPEC for NetBSD/sparc. */
|
108 |
|
|
#define CC1_SPEC32 \
|
109 |
|
|
"%{m32:%{m64:%emay not use both -m32 and -m64}} \
|
110 |
|
|
%{m64: \
|
111 |
|
|
-mptr64 -mstack-bias -mno-v8plus -mlong-double-128 \
|
112 |
|
|
%{!mcpu*:%{!mv8plus:-mcpu=ultrasparc}} \
|
113 |
|
|
%{!mno-vis:%{!mcpu=v9:-mvis}} \
|
114 |
|
|
%{p:-mcmodel=medlow} \
|
115 |
|
|
%{pg:-mcmodel=medlow}}"
|
116 |
|
|
|
117 |
|
|
#define CC1_SPEC64 \
|
118 |
|
|
"%{m32:%{m64:%emay not use both -m32 and -m64}} \
|
119 |
|
|
%{m32: \
|
120 |
|
|
-mptr32 -mno-stack-bias \
|
121 |
|
|
%{!mlong-double-128:-mlong-double-64} \
|
122 |
|
|
%{!mcpu*:%{!mv8plus:-mcpu=cypress}}} \
|
123 |
|
|
%{!m32: \
|
124 |
|
|
%{p:-mcmodel=medlow} \
|
125 |
|
|
%{pg:-mcmodel=medlow}}"
|
126 |
|
|
|
127 |
|
|
/* Make sure we use the right output format. Pick a default and then
|
128 |
|
|
make sure -m32/-m64 switch to the right one. */
|
129 |
|
|
|
130 |
|
|
#define LINK_ARCH32_SPEC "-m elf32_sparc"
|
131 |
|
|
|
132 |
|
|
#define LINK_ARCH64_SPEC "-m elf64_sparc"
|
133 |
|
|
|
134 |
|
|
#define LINK_ARCH_SPEC \
|
135 |
|
|
"%{m32:%(link_arch32)} \
|
136 |
|
|
%{m64:%(link_arch64)} \
|
137 |
|
|
%{!m32:%{!m64:%(link_arch_default)}}"
|
138 |
|
|
|
139 |
|
|
#undef LINK_SPEC
|
140 |
|
|
#define LINK_SPEC \
|
141 |
|
|
"%(link_arch) \
|
142 |
|
|
%{!mno-relax:%{!r:-relax}} \
|
143 |
|
|
%(netbsd_link_spec)"
|
144 |
|
|
|
145 |
|
|
#define NETBSD_ENTRY_POINT "__start"
|
146 |
|
|
|
147 |
|
|
#if DEFAULT_ARCH32_P
|
148 |
|
|
#define LINK_ARCH_DEFAULT_SPEC LINK_ARCH32_SPEC
|
149 |
|
|
#else
|
150 |
|
|
#define LINK_ARCH_DEFAULT_SPEC LINK_ARCH64_SPEC
|
151 |
|
|
#endif
|
152 |
|
|
|
153 |
|
|
/* What extra spec entries do we need? */
|
154 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
155 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
156 |
|
|
{ "link_arch32", LINK_ARCH32_SPEC }, \
|
157 |
|
|
{ "link_arch64", LINK_ARCH64_SPEC }, \
|
158 |
|
|
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
|
159 |
|
|
{ "link_arch", LINK_ARCH_SPEC }, \
|
160 |
|
|
{ "netbsd_cpp_spec", NETBSD_CPP_SPEC }, \
|
161 |
|
|
{ "netbsd_link_spec", NETBSD_LINK_SPEC_ELF }, \
|
162 |
|
|
{ "netbsd_entry_point", NETBSD_ENTRY_POINT },
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
/* Build a compiler that supports -m32 and -m64? */
|
166 |
|
|
|
167 |
|
|
#ifdef SPARC_BI_ARCH
|
168 |
|
|
|
169 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
170 |
|
|
#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
|
171 |
|
|
|
172 |
|
|
#if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
|
173 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
|
174 |
|
|
#else
|
175 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
176 |
|
|
#endif
|
177 |
|
|
|
178 |
|
|
#undef CC1_SPEC
|
179 |
|
|
#if DEFAULT_ARCH32_P
|
180 |
|
|
#define CC1_SPEC CC1_SPEC32
|
181 |
|
|
#else
|
182 |
|
|
#define CC1_SPEC CC1_SPEC64
|
183 |
|
|
#endif
|
184 |
|
|
|
185 |
|
|
#if DEFAULT_ARCH32_P
|
186 |
|
|
#define MULTILIB_DEFAULTS { "m32" }
|
187 |
|
|
#else
|
188 |
|
|
#define MULTILIB_DEFAULTS { "m64" }
|
189 |
|
|
#endif
|
190 |
|
|
|
191 |
|
|
#else /* SPARC_BI_ARCH */
|
192 |
|
|
|
193 |
|
|
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
194 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc
|
195 |
|
|
|
196 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
197 |
|
|
#define LONG_DOUBLE_TYPE_SIZE 128
|
198 |
|
|
|
199 |
|
|
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
|
200 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
|
201 |
|
|
|
202 |
|
|
#undef CC1_SPEC
|
203 |
|
|
#define CC1_SPEC CC1_SPEC64
|
204 |
|
|
|
205 |
|
|
#else /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
206 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
|
207 |
|
|
|
208 |
|
|
/* A 32-bit only compiler. NetBSD don't support 128 bit `long double'
|
209 |
|
|
for 32-bit code, unlike Solaris. */
|
210 |
|
|
|
211 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
212 |
|
|
#define LONG_DOUBLE_TYPE_SIZE 64
|
213 |
|
|
|
214 |
|
|
#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
|
215 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
216 |
|
|
|
217 |
|
|
#undef CC1_SPEC
|
218 |
|
|
#define CC1_SPEC CC1_SPEC32
|
219 |
|
|
|
220 |
|
|
#endif /* TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
221 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc */
|
222 |
|
|
|
223 |
|
|
#endif /* SPARC_BI_ARCH */
|
224 |
|
|
|
225 |
|
|
/* We use GNU ld so undefine this so that attribute((init_priority)) works. */
|
226 |
|
|
#undef CTORS_SECTION_ASM_OP
|
227 |
|
|
#undef DTORS_SECTION_ASM_OP
|