]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/sparc/linux64.h
expmed.c (expand_variable_shift): Rename to ...
[thirdparty/gcc.git] / gcc / config / sparc / linux64.h
CommitLineData
956d6950 1/* Definitions for 64-bit SPARC running Linux-based GNU systems with ELF.
66647d44 2 Copyright 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
dabadc52 3 2009, 2010, 2011 Free Software Foundation, Inc.
bfe87013
DE
4 Contributed by David S. Miller (davem@caip.rutgers.edu)
5
de0a398e 6This file is part of GCC.
bfe87013 7
de0a398e 8GCC is free software; you can redistribute it and/or modify
bfe87013 9it under the terms of the GNU General Public License as published by
2f83c7d6 10the Free Software Foundation; either version 3, or (at your option)
bfe87013
DE
11any later version.
12
de0a398e 13GCC is distributed in the hope that it will be useful,
bfe87013
DE
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
2f83c7d6
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
bfe87013 21
5f7ca34b
DM
22#define TARGET_OS_CPP_BUILTINS() \
23 do \
24 { \
107fd1c1 25 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
5f7ca34b
DM
26 if (TARGET_ARCH64) \
27 builtin_define ("_LONGLONG"); \
28 if (TARGET_ARCH32 \
29 && TARGET_LONG_DOUBLE_128) \
30 builtin_define ("__LONG_DOUBLE_128__"); \
31 } \
9b8466f4
NB
32 while (0)
33
f2c0cb15
JJ
34#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
35 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \
4c837a1e 36 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3 \
9eeaed6e
DM
37 || TARGET_CPU_DEFAULT == TARGET_CPU_niagara \
38 || TARGET_CPU_DEFAULT == TARGET_CPU_niagara2
345a6161
DM
39/* A 64 bit v9 compiler with stack-bias,
40 in a Medium/Low code model environment. */
41
42#undef TARGET_DEFAULT
43#define TARGET_DEFAULT \
44 (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
33074e5f 45 + MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
345a6161
DM
46#endif
47
5f7ca34b
DM
48/* This must be v9a not just v9 because by default we enable
49 -mvis. */
50#undef ASM_CPU64_DEFAULT_SPEC
51#define ASM_CPU64_DEFAULT_SPEC "-Av9a"
bfe87013 52
956d6950
JL
53/* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
54 the GNU/Linux magical crtend.o file (see crtstuff.c) which
bfe87013
DE
55 provides part of the support for getting C++ file-scope static
56 object constructed before entering `main', followed by a normal
956d6950 57 GNU/Linux "finalizer" file, `crtn.o'. */
bfe87013 58
5f7ca34b 59#undef ENDFILE_SPEC
5bbcd587 60#define ENDFILE_SPEC \
24a4dd31 61 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
5bbcd587 62 %{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
345a6161 63
a0a301fc
DE
64/* The default code model. */
65#undef SPARC_DEFAULT_CMODEL
be3f1ff5 66#define SPARC_DEFAULT_CMODEL CM_MEDLOW
bfe87013 67
bfe87013 68#undef WCHAR_TYPE
247cfc5c
JJ
69#define WCHAR_TYPE "int"
70
bfe87013 71#undef WCHAR_TYPE_SIZE
247cfc5c
JJ
72#define WCHAR_TYPE_SIZE 32
73
ba31d94e 74/* Define for support of TFmode long double.
56149abc 75 SPARC ABI says that long double is 4 words. */
a0a301fc 76#undef LONG_DOUBLE_TYPE_SIZE
4710d3eb
JJ
77#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
78
4710d3eb
JJ
79/* Define this to set long double type size to use in libgcc2.c, which can
80 not depend on target_flags. */
81#if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
82#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
83#else
84#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
85#endif
345a6161 86
a0a301fc
DE
87#undef CPP_SUBTARGET_SPEC
88#define CPP_SUBTARGET_SPEC "\
bfe87013 89%{posix:-D_POSIX_SOURCE} \
afc96791 90%{pthread:-D_REENTRANT} \
bfe87013 91"
afc96791 92
956d6950 93/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
bfe87013
DE
94 for the special GCC options -static and -shared, which allow us to
95 link things in one of these three modes by applying the appropriate
83c2a9ef 96 combinations of options at link-time.
bfe87013
DE
97
98 When the -shared link option is used a final link is not being
99 done. */
100
7bd85ce0
JM
101#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
102#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
7bd85ce0 103
345a6161
DM
104#ifdef SPARC_BI_ARCH
105
106#undef SUBTARGET_EXTRA_SPECS
107#define SUBTARGET_EXTRA_SPECS \
108 { "link_arch32", LINK_ARCH32_SPEC }, \
109 { "link_arch64", LINK_ARCH64_SPEC }, \
110 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
111 { "link_arch", LINK_ARCH_SPEC },
7bd85ce0 112
c71cfaaf 113#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,%R/usr/lib %{shared:-shared} \
345a6161 114 %{!shared: \
dabadc52
JM
115 %{!static: \
116 %{rdynamic:-export-dynamic} \
107fd1c1 117 -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \
dabadc52 118 %{static:-static}} \
345a6161
DM
119"
120
c71cfaaf 121#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
345a6161 122 %{!shared: \
dabadc52
JM
123 %{!static: \
124 %{rdynamic:-export-dynamic} \
107fd1c1 125 -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
dabadc52 126 %{static:-static}} \
345a6161
DM
127"
128
129#define LINK_ARCH_SPEC "\
130%{m32:%(link_arch32)} \
131%{m64:%(link_arch64)} \
132%{!m32:%{!m64:%(link_arch_default)}} \
133"
134
135#define LINK_ARCH_DEFAULT_SPEC \
136(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
137
bfe87013 138#undef LINK_SPEC
345a6161
DM
139#define LINK_SPEC "\
140%(link_arch) \
141%{mlittle-endian:-EL} \
e95b1e6a 142%{!mno-relax:%{!r:-relax}} \
345a6161
DM
143"
144
145#undef CC1_SPEC
146#if DEFAULT_ARCH32_P
5f7ca34b 147#define CC1_SPEC "%{profile:-p} \
d6964c30 148%{m32:%{m64:%emay not use both -m32 and -m64}} \
4710d3eb 149%{m64:-mptr64 -mstack-bias -mlong-double-128 \
3a7b4385 150 %{!mcpu*:-mcpu=ultrasparc} \
247cfc5c 151 %{!mno-vis:%{!mcpu=v9:-mvis}}} \
345a6161
DM
152"
153#else
5f7ca34b 154#define CC1_SPEC "%{profile:-p} \
d6964c30 155%{m32:%{m64:%emay not use both -m32 and -m64}} \
4710d3eb 156%{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
3a7b4385 157 %{!mcpu*:-mcpu=cypress}} \
9ce13279 158%{!m32:%{!mcpu*:-mcpu=ultrasparc}} \
247cfc5c 159%{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \
345a6161
DM
160"
161#endif
162
942e0f44
JJ
163/* Support for a compile-time default CPU, et cetera. The rules are:
164 --with-cpu is ignored if -mcpu is specified.
165 --with-tune is ignored if -mtune is specified.
166 --with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
167 are specified.
168 In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
169 here, otherwise say -mcpu=v7 would be passed even when -m64.
170 CC1_SPEC above takes care of this instead. */
171#undef OPTION_DEFAULT_SPECS
172#if DEFAULT_ARCH32_P
173#define OPTION_DEFAULT_SPECS \
174 {"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
175 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
c6869789 176 {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
942e0f44
JJ
177#else
178#define OPTION_DEFAULT_SPECS \
179 {"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
180 {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
c6869789 181 {"float", "%{!msoft-float:%{!mhard-float:%{!mfpu:%{!mno-fpu:-m%(VALUE)-float}}}}" }
942e0f44
JJ
182#endif
183
345a6161
DM
184#if DEFAULT_ARCH32_P
185#define MULTILIB_DEFAULTS { "m32" }
186#else
187#define MULTILIB_DEFAULTS { "m64" }
188#endif
189
190#else /* !SPARC_BI_ARCH */
191
192#undef LINK_SPEC
c71cfaaf 193#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
bfe87013 194 %{!shared: \
dabadc52
JM
195 %{!static: \
196 %{rdynamic:-export-dynamic} \
107fd1c1 197 -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \
dabadc52 198 %{static:-static}} \
bfe87013 199%{mlittle-endian:-EL} \
e95b1e6a 200%{!mno-relax:%{!r:-relax}} \
bfe87013
DE
201"
202
345a6161
DM
203#endif /* !SPARC_BI_ARCH */
204
12eb1a9c 205/* It's safe to pass -s always, even if -g is not used. */
bfe87013
DE
206#undef ASM_SPEC
207#define ASM_SPEC "\
1141be7e 208-s \
40ea67af
EB
209%{fpic|fPIC|fpie|fPIE:-K PIC} \
210%{!.c:%{findirect-dispatch:-K PIC}} \
bfe87013 211%{mlittle-endian:-EL} \
e95b1e6a 212%(asm_cpu) %(asm_arch) %(asm_relax)"
bfe87013 213
bfe87013
DE
214#undef ASM_OUTPUT_ALIGNED_LOCAL
215#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
216do { \
217 fputs ("\t.local\t", (FILE)); \
218 assemble_name ((FILE), (NAME)); \
219 putc ('\n', (FILE)); \
220 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
221} while (0)
222
223#undef COMMON_ASM_OP
471b6f1b 224#define COMMON_ASM_OP "\t.common\t"
bfe87013 225
59f96879
RH
226#undef LOCAL_LABEL_PREFIX
227#define LOCAL_LABEL_PREFIX "."
228
bfe87013
DE
229/* This is how to store into the string LABEL
230 the symbol_ref name of an internal numbered label where
231 PREFIX is the class of label and NUM is the number within the class.
232 This is suitable for output with `assemble_name'. */
233
234#undef ASM_GENERATE_INTERNAL_LABEL
235#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
e59f7d3d 236 sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM))
bfe87013 237
bfe87013
DE
238/* DWARF bits. */
239
240/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets.
d6a7951f 241 Obviously the Dwarf2 folks haven't tried to actually build systems
bfe87013
DE
242 with their spec. On a 64-bit system, only 64-bit relocs become
243 RELATIVE relocations. */
244
245/* #define DWARF_OFFSET_SIZE PTR_SIZE */
275b60d6 246
45dcc026
JJ
247#undef DITF_CONVERSION_LIBFUNCS
248#define DITF_CONVERSION_LIBFUNCS 1
f7e0e539 249\f
5751a10b
JJ
250#ifdef HAVE_AS_TLS
251#undef TARGET_SUN_TLS
252#undef TARGET_GNU_TLS
253#define TARGET_SUN_TLS 0
254#define TARGET_GNU_TLS 1
255#endif
256\f
7a31a340
DM
257/* We use GNU ld so undefine this so that attribute((init_priority)) works. */
258#undef CTORS_SECTION_ASM_OP
259#undef DTORS_SECTION_ASM_OP
db430d26 260
260c8ba3
EB
261/* Static stack checking is supported by means of probes. */
262#define STACK_CHECK_STATIC_BUILTIN 1
263
8662eb14 264#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
548a6c4f
EB
265
266/* Linux currently uses RMO in uniprocessor mode, which is equivalent to
267 TMO, and TMO in multiprocessor mode. But they reserve the right to
268 change their minds. */
269#undef SPARC_RELAXED_ORDERING
270#define SPARC_RELAXED_ORDERING true
5e77eb53
EB
271
272#undef NEED_INDICATE_EXEC_STACK
273#define NEED_INDICATE_EXEC_STACK 1
8ec11fe9
JJ
274
275#ifdef TARGET_LIBC_PROVIDES_SSP
276/* sparc glibc provides __stack_chk_guard in [%g7 + 0x14],
277 sparc64 glibc provides it at [%g7 + 0x28]. */
278#define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14)
279#endif
7269aee7
AH
280
281/* Define if long doubles should be mangled as 'g'. */
282#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
cc44abe6
DM
283
284/* We use glibc _mcount for profiling. */
b61eacd6 285#undef NO_PROFILE_COUNTERS
cc44abe6 286#define NO_PROFILE_COUNTERS 1