1 |
709 |
jeremybenn |
/* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF.
|
2 |
|
|
Copyright 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
3 |
|
|
2009, 2010, 2011 Free Software Foundation, Inc.
|
4 |
|
|
Contributed by David S. Miller (davem@caip.rutgers.edu)
|
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 3, 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 COPYING3. If not see
|
20 |
|
|
<http://www.gnu.org/licenses/>. */
|
21 |
|
|
|
22 |
|
|
#define TARGET_OS_CPP_BUILTINS() \
|
23 |
|
|
do \
|
24 |
|
|
{ \
|
25 |
|
|
GNU_USER_TARGET_OS_CPP_BUILTINS(); \
|
26 |
|
|
if (TARGET_ARCH64) \
|
27 |
|
|
builtin_define ("_LONGLONG"); \
|
28 |
|
|
if (TARGET_ARCH32 \
|
29 |
|
|
&& TARGET_LONG_DOUBLE_128) \
|
30 |
|
|
builtin_define ("__LONG_DOUBLE_128__"); \
|
31 |
|
|
} \
|
32 |
|
|
while (0)
|
33 |
|
|
|
34 |
|
|
/* On Linux, the combination sparc64-* --with-cpu=v8 is supported and
|
35 |
|
|
selects a 32-bit compiler. */
|
36 |
|
|
#if defined(TARGET_64BIT_DEFAULT) && TARGET_CPU_DEFAULT >= TARGET_CPU_v9
|
37 |
|
|
#undef TARGET_DEFAULT
|
38 |
|
|
#define TARGET_DEFAULT \
|
39 |
|
|
(MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_STACK_BIAS + \
|
40 |
|
|
MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
|
41 |
|
|
#endif
|
42 |
|
|
|
43 |
|
|
/* This must be v9a not just v9 because by default we enable
|
44 |
|
|
-mvis. */
|
45 |
|
|
#undef ASM_CPU64_DEFAULT_SPEC
|
46 |
|
|
#define ASM_CPU64_DEFAULT_SPEC "-Av9a"
|
47 |
|
|
|
48 |
|
|
/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
|
49 |
|
|
the GNU/Linux magical crtend.o file (see crtstuff.c) which
|
50 |
|
|
provides part of the support for getting C++ file-scope static
|
51 |
|
|
object constructed before entering `main', followed by a normal
|
52 |
|
|
GNU/Linux "finalizer" file, `crtn.o'. */
|
53 |
|
|
|
54 |
|
|
#undef ENDFILE_SPEC
|
55 |
|
|
#define ENDFILE_SPEC \
|
56 |
|
|
"%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
|
57 |
|
|
%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
|
58 |
|
|
|
59 |
|
|
/* The default code model. */
|
60 |
|
|
#undef SPARC_DEFAULT_CMODEL
|
61 |
|
|
#define SPARC_DEFAULT_CMODEL CM_MEDLOW
|
62 |
|
|
|
63 |
|
|
#undef WCHAR_TYPE
|
64 |
|
|
#define WCHAR_TYPE "int"
|
65 |
|
|
|
66 |
|
|
#undef WCHAR_TYPE_SIZE
|
67 |
|
|
#define WCHAR_TYPE_SIZE 32
|
68 |
|
|
|
69 |
|
|
/* Define for support of TFmode long double.
|
70 |
|
|
SPARC ABI says that long double is 4 words. */
|
71 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
72 |
|
|
#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
|
73 |
|
|
|
74 |
|
|
/* Define this to set long double type size to use in libgcc2.c, which can
|
75 |
|
|
not depend on target_flags. */
|
76 |
|
|
#if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
|
77 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
|
78 |
|
|
#else
|
79 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
80 |
|
|
#endif
|
81 |
|
|
|
82 |
|
|
#undef CPP_SUBTARGET_SPEC
|
83 |
|
|
#define CPP_SUBTARGET_SPEC "\
|
84 |
|
|
%{posix:-D_POSIX_SOURCE} \
|
85 |
|
|
%{pthread:-D_REENTRANT} \
|
86 |
|
|
"
|
87 |
|
|
|
88 |
|
|
/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
|
89 |
|
|
for the special GCC options -static and -shared, which allow us to
|
90 |
|
|
link things in one of these three modes by applying the appropriate
|
91 |
|
|
combinations of options at link-time.
|
92 |
|
|
|
93 |
|
|
When the -shared link option is used a final link is not being
|
94 |
|
|
done. */
|
95 |
|
|
|
96 |
|
|
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
|
97 |
|
|
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
|
98 |
|
|
|
99 |
|
|
#ifdef SPARC_BI_ARCH
|
100 |
|
|
|
101 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
102 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
103 |
|
|
{ "link_arch32", LINK_ARCH32_SPEC }, \
|
104 |
|
|
{ "link_arch64", LINK_ARCH64_SPEC }, \
|
105 |
|
|
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
|
106 |
|
|
{ "link_arch", LINK_ARCH_SPEC },
|
107 |
|
|
|
108 |
|
|
#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,%R/usr/lib %{shared:-shared} \
|
109 |
|
|
%{!shared: \
|
110 |
|
|
%{!static: \
|
111 |
|
|
%{rdynamic:-export-dynamic} \
|
112 |
|
|
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \
|
113 |
|
|
%{static:-static}} \
|
114 |
|
|
"
|
115 |
|
|
|
116 |
|
|
#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
|
117 |
|
|
%{!shared: \
|
118 |
|
|
%{!static: \
|
119 |
|
|
%{rdynamic:-export-dynamic} \
|
120 |
|
|
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
|
121 |
|
|
%{static:-static}} \
|
122 |
|
|
"
|
123 |
|
|
|
124 |
|
|
#define LINK_ARCH_SPEC "\
|
125 |
|
|
%{m32:%(link_arch32)} \
|
126 |
|
|
%{m64:%(link_arch64)} \
|
127 |
|
|
%{!m32:%{!m64:%(link_arch_default)}} \
|
128 |
|
|
"
|
129 |
|
|
|
130 |
|
|
#define LINK_ARCH_DEFAULT_SPEC \
|
131 |
|
|
(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
|
132 |
|
|
|
133 |
|
|
#undef LINK_SPEC
|
134 |
|
|
#define LINK_SPEC "\
|
135 |
|
|
%(link_arch) \
|
136 |
|
|
%{!mno-relax:%{!r:-relax}} \
|
137 |
|
|
"
|
138 |
|
|
|
139 |
|
|
/* -mcpu=native handling only makes sense with compiler running on
|
140 |
|
|
a SPARC chip. */
|
141 |
|
|
#if defined(__sparc__) && defined(__linux__)
|
142 |
|
|
extern const char *host_detect_local_cpu (int argc, const char **argv);
|
143 |
|
|
# define EXTRA_SPEC_FUNCTIONS \
|
144 |
|
|
{ "local_cpu_detect", host_detect_local_cpu },
|
145 |
|
|
|
146 |
|
|
# define MCPU_MTUNE_NATIVE_SPECS \
|
147 |
|
|
" %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \
|
148 |
|
|
" %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
|
149 |
|
|
#else
|
150 |
|
|
# define MCPU_MTUNE_NATIVE_SPECS ""
|
151 |
|
|
#endif
|
152 |
|
|
|
153 |
|
|
#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
|
154 |
|
|
|
155 |
|
|
#undef CC1_SPEC
|
156 |
|
|
#if DEFAULT_ARCH32_P
|
157 |
|
|
#define CC1_SPEC "%{profile:-p} \
|
158 |
|
|
%{m32:%{m64:%emay not use both -m32 and -m64}} \
|
159 |
|
|
%{m64:-mptr64 -mstack-bias -mlong-double-128 \
|
160 |
|
|
%{!mcpu*:-mcpu=ultrasparc} \
|
161 |
|
|
%{!mno-vis:%{!mcpu=v9:-mvis}}} \
|
162 |
|
|
"
|
163 |
|
|
#else
|
164 |
|
|
#define CC1_SPEC "%{profile:-p} \
|
165 |
|
|
%{m32:%{m64:%emay not use both -m32 and -m64}} \
|
166 |
|
|
%{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
|
167 |
|
|
%{!mcpu*:-mcpu=cypress}} \
|
168 |
|
|
%{mv8plus:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
|
169 |
|
|
%{!mcpu*:-mcpu=v9}} \
|
170 |
|
|
%{!m32:%{!mcpu*:-mcpu=ultrasparc}} \
|
171 |
|
|
%{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \
|
172 |
|
|
"
|
173 |
|
|
#endif
|
174 |
|
|
|
175 |
|
|
/* Support for a compile-time default CPU, et cetera. The rules are:
|
176 |
|
|
--with-cpu is ignored if -mcpu is specified.
|
177 |
|
|
--with-tune is ignored if -mtune is specified.
|
178 |
|
|
--with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
|
179 |
|
|
are specified.
|
180 |
|
|
In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
|
181 |
|
|
here, otherwise say -mcpu=v7 would be passed even when -m64.
|
182 |
|
|
CC1_SPEC above takes care of this instead. */
|
183 |
|
|
#undef OPTION_DEFAULT_SPECS
|
184 |
|
|
#if DEFAULT_ARCH32_P
|
185 |
|
|
#define OPTION_DEFAULT_SPECS \
|
186 |
|
|
{"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
|
187 |
|
|
{"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
|
188 |
|
|
{"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
|
189 |
|
|
#else
|
190 |
|
|
#define OPTION_DEFAULT_SPECS \
|
191 |
|
|
{"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
|
192 |
|
|
{"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
|
193 |
|
|
{"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
|
194 |
|
|
#endif
|
195 |
|
|
|
196 |
|
|
#if DEFAULT_ARCH32_P
|
197 |
|
|
#define MULTILIB_DEFAULTS { "m32" }
|
198 |
|
|
#else
|
199 |
|
|
#define MULTILIB_DEFAULTS { "m64" }
|
200 |
|
|
#endif
|
201 |
|
|
|
202 |
|
|
#else /* !SPARC_BI_ARCH */
|
203 |
|
|
|
204 |
|
|
#undef LINK_SPEC
|
205 |
|
|
#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
|
206 |
|
|
%{!shared: \
|
207 |
|
|
%{!static: \
|
208 |
|
|
%{rdynamic:-export-dynamic} \
|
209 |
|
|
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
|
210 |
|
|
%{static:-static}} \
|
211 |
|
|
%{!mno-relax:%{!r:-relax}} \
|
212 |
|
|
"
|
213 |
|
|
|
214 |
|
|
#endif /* !SPARC_BI_ARCH */
|
215 |
|
|
|
216 |
|
|
/* It's safe to pass -s always, even if -g is not used. */
|
217 |
|
|
#undef ASM_SPEC
|
218 |
|
|
#define ASM_SPEC "\
|
219 |
|
|
-s \
|
220 |
|
|
%{fpic|fPIC|fpie|fPIE:-K PIC} \
|
221 |
|
|
%{!.c:%{findirect-dispatch:-K PIC}} \
|
222 |
|
|
%(asm_cpu) %(asm_arch) %(asm_relax)"
|
223 |
|
|
|
224 |
|
|
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
225 |
|
|
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
226 |
|
|
do { \
|
227 |
|
|
fputs ("\t.local\t", (FILE)); \
|
228 |
|
|
assemble_name ((FILE), (NAME)); \
|
229 |
|
|
putc ('\n', (FILE)); \
|
230 |
|
|
ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
|
231 |
|
|
} while (0)
|
232 |
|
|
|
233 |
|
|
#undef COMMON_ASM_OP
|
234 |
|
|
#define COMMON_ASM_OP "\t.common\t"
|
235 |
|
|
|
236 |
|
|
#undef LOCAL_LABEL_PREFIX
|
237 |
|
|
#define LOCAL_LABEL_PREFIX "."
|
238 |
|
|
|
239 |
|
|
/* DWARF bits. */
|
240 |
|
|
|
241 |
|
|
/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets.
|
242 |
|
|
Obviously the Dwarf2 folks haven't tried to actually build systems
|
243 |
|
|
with their spec. On a 64-bit system, only 64-bit relocs become
|
244 |
|
|
RELATIVE relocations. */
|
245 |
|
|
|
246 |
|
|
/* #define DWARF_OFFSET_SIZE PTR_SIZE */
|
247 |
|
|
|
248 |
|
|
#undef DITF_CONVERSION_LIBFUNCS
|
249 |
|
|
#define DITF_CONVERSION_LIBFUNCS 1
|
250 |
|
|
|
251 |
|
|
#ifdef HAVE_AS_TLS
|
252 |
|
|
#undef TARGET_SUN_TLS
|
253 |
|
|
#undef TARGET_GNU_TLS
|
254 |
|
|
#define TARGET_SUN_TLS 0
|
255 |
|
|
#define TARGET_GNU_TLS 1
|
256 |
|
|
#endif
|
257 |
|
|
|
258 |
|
|
/* We use GNU ld so undefine this so that attribute((init_priority)) works. */
|
259 |
|
|
#undef CTORS_SECTION_ASM_OP
|
260 |
|
|
#undef DTORS_SECTION_ASM_OP
|
261 |
|
|
|
262 |
|
|
/* Static stack checking is supported by means of probes. */
|
263 |
|
|
#define STACK_CHECK_STATIC_BUILTIN 1
|
264 |
|
|
|
265 |
|
|
/* Linux currently uses RMO in uniprocessor mode, which is equivalent to
|
266 |
|
|
TMO, and TMO in multiprocessor mode. But they reserve the right to
|
267 |
|
|
change their minds. */
|
268 |
|
|
#undef SPARC_RELAXED_ORDERING
|
269 |
|
|
#define SPARC_RELAXED_ORDERING true
|
270 |
|
|
|
271 |
|
|
#undef NEED_INDICATE_EXEC_STACK
|
272 |
|
|
#define NEED_INDICATE_EXEC_STACK 1
|
273 |
|
|
|
274 |
|
|
#ifdef TARGET_LIBC_PROVIDES_SSP
|
275 |
|
|
/* sparc glibc provides __stack_chk_guard in [%g7 + 0x14],
|
276 |
|
|
sparc64 glibc provides it at [%g7 + 0x28]. */
|
277 |
|
|
#define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14)
|
278 |
|
|
#endif
|
279 |
|
|
|
280 |
|
|
/* Define if long doubles should be mangled as 'g'. */
|
281 |
|
|
#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
|
282 |
|
|
|
283 |
|
|
/* We use glibc _mcount for profiling. */
|
284 |
|
|
#undef NO_PROFILE_COUNTERS
|
285 |
|
|
#define NO_PROFILE_COUNTERS 1
|