| 1 |
282 |
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 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 |
|
|
LINUX_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 |
|
|
#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
|
| 35 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \
|
| 36 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3 \
|
| 37 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_niagara \
|
| 38 |
|
|
|| TARGET_CPU_DEFAULT == TARGET_CPU_niagara2
|
| 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 */ \
|
| 45 |
|
|
+ MASK_STACK_BIAS + MASK_APP_REGS + MASK_FPU + MASK_LONG_DOUBLE_128)
|
| 46 |
|
|
#endif
|
| 47 |
|
|
|
| 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"
|
| 52 |
|
|
|
| 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
|
| 55 |
|
|
provides part of the support for getting C++ file-scope static
|
| 56 |
|
|
object constructed before entering `main', followed by a normal
|
| 57 |
|
|
GNU/Linux "finalizer" file, `crtn.o'. */
|
| 58 |
|
|
|
| 59 |
|
|
#undef ENDFILE_SPEC
|
| 60 |
|
|
#define ENDFILE_SPEC \
|
| 61 |
|
|
"%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
|
| 62 |
|
|
%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
|
| 63 |
|
|
|
| 64 |
|
|
#undef TARGET_VERSION
|
| 65 |
|
|
#define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)");
|
| 66 |
|
|
|
| 67 |
|
|
/* The default code model. */
|
| 68 |
|
|
#undef SPARC_DEFAULT_CMODEL
|
| 69 |
|
|
#define SPARC_DEFAULT_CMODEL CM_MEDLOW
|
| 70 |
|
|
|
| 71 |
|
|
#undef WCHAR_TYPE
|
| 72 |
|
|
#define WCHAR_TYPE "int"
|
| 73 |
|
|
|
| 74 |
|
|
#undef WCHAR_TYPE_SIZE
|
| 75 |
|
|
#define WCHAR_TYPE_SIZE 32
|
| 76 |
|
|
|
| 77 |
|
|
/* Define for support of TFmode long double.
|
| 78 |
|
|
SPARC ABI says that long double is 4 words. */
|
| 79 |
|
|
#undef LONG_DOUBLE_TYPE_SIZE
|
| 80 |
|
|
#define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
|
| 81 |
|
|
|
| 82 |
|
|
/* Define this to set long double type size to use in libgcc2.c, which can
|
| 83 |
|
|
not depend on target_flags. */
|
| 84 |
|
|
#if defined(__arch64__) || defined(__LONG_DOUBLE_128__)
|
| 85 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
|
| 86 |
|
|
#else
|
| 87 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
|
| 88 |
|
|
#endif
|
| 89 |
|
|
|
| 90 |
|
|
#undef CPP_SUBTARGET_SPEC
|
| 91 |
|
|
#define CPP_SUBTARGET_SPEC "\
|
| 92 |
|
|
%{posix:-D_POSIX_SOURCE} \
|
| 93 |
|
|
%{pthread:-D_REENTRANT} \
|
| 94 |
|
|
"
|
| 95 |
|
|
|
| 96 |
|
|
/* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
|
| 97 |
|
|
for the special GCC options -static and -shared, which allow us to
|
| 98 |
|
|
link things in one of these three modes by applying the appropriate
|
| 99 |
|
|
combinations of options at link-time. We like to support here for
|
| 100 |
|
|
as many of the other GNU linker options as possible. But I don't
|
| 101 |
|
|
have the time to search for those flags. I am sure how to add
|
| 102 |
|
|
support for -soname shared_object_name. H.J.
|
| 103 |
|
|
|
| 104 |
|
|
I took out %{v:%{!V:-V}}. It is too much :-(. They can use
|
| 105 |
|
|
-Wl,-V.
|
| 106 |
|
|
|
| 107 |
|
|
When the -shared link option is used a final link is not being
|
| 108 |
|
|
done. */
|
| 109 |
|
|
|
| 110 |
|
|
/* If ELF is the default format, we should not use /lib/elf. */
|
| 111 |
|
|
|
| 112 |
|
|
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
|
| 113 |
|
|
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
|
| 114 |
|
|
|
| 115 |
|
|
#ifdef SPARC_BI_ARCH
|
| 116 |
|
|
|
| 117 |
|
|
#undef SUBTARGET_EXTRA_SPECS
|
| 118 |
|
|
#define SUBTARGET_EXTRA_SPECS \
|
| 119 |
|
|
{ "link_arch32", LINK_ARCH32_SPEC }, \
|
| 120 |
|
|
{ "link_arch64", LINK_ARCH64_SPEC }, \
|
| 121 |
|
|
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
|
| 122 |
|
|
{ "link_arch", LINK_ARCH_SPEC },
|
| 123 |
|
|
|
| 124 |
|
|
#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,%R/usr/lib %{shared:-shared} \
|
| 125 |
|
|
%{!shared: \
|
| 126 |
|
|
%{!ibcs: \
|
| 127 |
|
|
%{!static: \
|
| 128 |
|
|
%{rdynamic:-export-dynamic} \
|
| 129 |
|
|
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}} \
|
| 130 |
|
|
%{static:-static}}} \
|
| 131 |
|
|
"
|
| 132 |
|
|
|
| 133 |
|
|
#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
|
| 134 |
|
|
%{!shared: \
|
| 135 |
|
|
%{!ibcs: \
|
| 136 |
|
|
%{!static: \
|
| 137 |
|
|
%{rdynamic:-export-dynamic} \
|
| 138 |
|
|
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}} \
|
| 139 |
|
|
%{static:-static}}} \
|
| 140 |
|
|
"
|
| 141 |
|
|
|
| 142 |
|
|
#define LINK_ARCH_SPEC "\
|
| 143 |
|
|
%{m32:%(link_arch32)} \
|
| 144 |
|
|
%{m64:%(link_arch64)} \
|
| 145 |
|
|
%{!m32:%{!m64:%(link_arch_default)}} \
|
| 146 |
|
|
"
|
| 147 |
|
|
|
| 148 |
|
|
#define LINK_ARCH_DEFAULT_SPEC \
|
| 149 |
|
|
(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC)
|
| 150 |
|
|
|
| 151 |
|
|
#undef LINK_SPEC
|
| 152 |
|
|
#define LINK_SPEC "\
|
| 153 |
|
|
%(link_arch) \
|
| 154 |
|
|
%{mlittle-endian:-EL} \
|
| 155 |
|
|
%{!mno-relax:%{!r:-relax}} \
|
| 156 |
|
|
"
|
| 157 |
|
|
|
| 158 |
|
|
#undef CC1_SPEC
|
| 159 |
|
|
#if DEFAULT_ARCH32_P
|
| 160 |
|
|
#define CC1_SPEC "%{profile:-p} \
|
| 161 |
|
|
%{sun4:} %{target:} \
|
| 162 |
|
|
%{mcypress:-mcpu=cypress} \
|
| 163 |
|
|
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
| 164 |
|
|
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
| 165 |
|
|
%{m32:%{m64:%emay not use both -m32 and -m64}} \
|
| 166 |
|
|
%{m64:-mptr64 -mstack-bias -mlong-double-128 \
|
| 167 |
|
|
%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=ultrasparc}}}}}}} \
|
| 168 |
|
|
%{!mno-vis:%{!mcpu=v9:-mvis}}} \
|
| 169 |
|
|
"
|
| 170 |
|
|
#else
|
| 171 |
|
|
#define CC1_SPEC "%{profile:-p} \
|
| 172 |
|
|
%{sun4:} %{target:} \
|
| 173 |
|
|
%{mcypress:-mcpu=cypress} \
|
| 174 |
|
|
%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \
|
| 175 |
|
|
%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \
|
| 176 |
|
|
%{m32:%{m64:%emay not use both -m32 and -m64}} \
|
| 177 |
|
|
%{m32:-mptr32 -mno-stack-bias %{!mlong-double-128:-mlong-double-64} \
|
| 178 |
|
|
%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:-mcpu=cypress}}}}}}}} \
|
| 179 |
|
|
%{!m32:%{!mcpu*:-mcpu=ultrasparc}} \
|
| 180 |
|
|
%{!mno-vis:%{!m32:%{!mcpu=v9:-mvis}}} \
|
| 181 |
|
|
"
|
| 182 |
|
|
#endif
|
| 183 |
|
|
|
| 184 |
|
|
/* Support for a compile-time default CPU, et cetera. The rules are:
|
| 185 |
|
|
--with-cpu is ignored if -mcpu is specified.
|
| 186 |
|
|
--with-tune is ignored if -mtune is specified.
|
| 187 |
|
|
--with-float is ignored if -mhard-float, -msoft-float, -mfpu, or -mno-fpu
|
| 188 |
|
|
are specified.
|
| 189 |
|
|
In the SPARC_BI_ARCH compiler we cannot pass %{!mcpu=*:-mcpu=%(VALUE)}
|
| 190 |
|
|
here, otherwise say -mcpu=v7 would be passed even when -m64.
|
| 191 |
|
|
CC1_SPEC above takes care of this instead. */
|
| 192 |
|
|
#undef OPTION_DEFAULT_SPECS
|
| 193 |
|
|
#if DEFAULT_ARCH32_P
|
| 194 |
|
|
#define OPTION_DEFAULT_SPECS \
|
| 195 |
|
|
{"cpu", "%{!m64:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
|
| 196 |
|
|
{"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
|
| 197 |
|
|
{"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
|
| 198 |
|
|
#else
|
| 199 |
|
|
#define OPTION_DEFAULT_SPECS \
|
| 200 |
|
|
{"cpu", "%{!m32:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
|
| 201 |
|
|
{"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
|
| 202 |
|
|
{"float", "%{!msoft-float:%{!mhard-float:%{!fpu:%{!no-fpu:-m%(VALUE)-float}}}}" }
|
| 203 |
|
|
#endif
|
| 204 |
|
|
|
| 205 |
|
|
#if DEFAULT_ARCH32_P
|
| 206 |
|
|
#define MULTILIB_DEFAULTS { "m32" }
|
| 207 |
|
|
#else
|
| 208 |
|
|
#define MULTILIB_DEFAULTS { "m64" }
|
| 209 |
|
|
#endif
|
| 210 |
|
|
|
| 211 |
|
|
#else /* !SPARC_BI_ARCH */
|
| 212 |
|
|
|
| 213 |
|
|
#undef LINK_SPEC
|
| 214 |
|
|
#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
|
| 215 |
|
|
%{!shared: \
|
| 216 |
|
|
%{!ibcs: \
|
| 217 |
|
|
%{!static: \
|
| 218 |
|
|
%{rdynamic:-export-dynamic} \
|
| 219 |
|
|
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}} \
|
| 220 |
|
|
%{static:-static}}} \
|
| 221 |
|
|
%{mlittle-endian:-EL} \
|
| 222 |
|
|
%{!mno-relax:%{!r:-relax}} \
|
| 223 |
|
|
"
|
| 224 |
|
|
|
| 225 |
|
|
#endif /* !SPARC_BI_ARCH */
|
| 226 |
|
|
|
| 227 |
|
|
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
| 228 |
|
|
It's safe to pass -s always, even if -g is not used. */
|
| 229 |
|
|
#undef ASM_SPEC
|
| 230 |
|
|
#define ASM_SPEC "\
|
| 231 |
|
|
%{V} \
|
| 232 |
|
|
%{v:%{!V:-V}} \
|
| 233 |
|
|
%{!Qn:-Qy} \
|
| 234 |
|
|
%{n} \
|
| 235 |
|
|
%{T} \
|
| 236 |
|
|
%{Ym,*} \
|
| 237 |
|
|
%{Wa,*:%*} \
|
| 238 |
|
|
-s \
|
| 239 |
|
|
%{fpic|fPIC|fpie|fPIE|findirect-dispatch:-K PIC} \
|
| 240 |
|
|
%{mlittle-endian:-EL} \
|
| 241 |
|
|
%(asm_cpu) %(asm_arch) %(asm_relax)"
|
| 242 |
|
|
|
| 243 |
|
|
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
| 244 |
|
|
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
| 245 |
|
|
do { \
|
| 246 |
|
|
fputs ("\t.local\t", (FILE)); \
|
| 247 |
|
|
assemble_name ((FILE), (NAME)); \
|
| 248 |
|
|
putc ('\n', (FILE)); \
|
| 249 |
|
|
ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
|
| 250 |
|
|
} while (0)
|
| 251 |
|
|
|
| 252 |
|
|
#undef COMMON_ASM_OP
|
| 253 |
|
|
#define COMMON_ASM_OP "\t.common\t"
|
| 254 |
|
|
|
| 255 |
|
|
#undef LOCAL_LABEL_PREFIX
|
| 256 |
|
|
#define LOCAL_LABEL_PREFIX "."
|
| 257 |
|
|
|
| 258 |
|
|
/* This is how to store into the string LABEL
|
| 259 |
|
|
the symbol_ref name of an internal numbered label where
|
| 260 |
|
|
PREFIX is the class of label and NUM is the number within the class.
|
| 261 |
|
|
This is suitable for output with `assemble_name'. */
|
| 262 |
|
|
|
| 263 |
|
|
#undef ASM_GENERATE_INTERNAL_LABEL
|
| 264 |
|
|
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
| 265 |
|
|
sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM))
|
| 266 |
|
|
|
| 267 |
|
|
/* DWARF bits. */
|
| 268 |
|
|
|
| 269 |
|
|
/* Follow Irix 6 and not the Dwarf2 draft in using 64-bit offsets.
|
| 270 |
|
|
Obviously the Dwarf2 folks haven't tried to actually build systems
|
| 271 |
|
|
with their spec. On a 64-bit system, only 64-bit relocs become
|
| 272 |
|
|
RELATIVE relocations. */
|
| 273 |
|
|
|
| 274 |
|
|
/* #define DWARF_OFFSET_SIZE PTR_SIZE */
|
| 275 |
|
|
|
| 276 |
|
|
#undef DITF_CONVERSION_LIBFUNCS
|
| 277 |
|
|
#define DITF_CONVERSION_LIBFUNCS 1
|
| 278 |
|
|
|
| 279 |
|
|
#ifdef HAVE_AS_TLS
|
| 280 |
|
|
#undef TARGET_SUN_TLS
|
| 281 |
|
|
#undef TARGET_GNU_TLS
|
| 282 |
|
|
#define TARGET_SUN_TLS 0
|
| 283 |
|
|
#define TARGET_GNU_TLS 1
|
| 284 |
|
|
#endif
|
| 285 |
|
|
|
| 286 |
|
|
/* We use GNU ld so undefine this so that attribute((init_priority)) works. */
|
| 287 |
|
|
#undef CTORS_SECTION_ASM_OP
|
| 288 |
|
|
#undef DTORS_SECTION_ASM_OP
|
| 289 |
|
|
|
| 290 |
|
|
#define MD_UNWIND_SUPPORT "config/sparc/linux-unwind.h"
|
| 291 |
|
|
|
| 292 |
|
|
/* Linux currently uses RMO in uniprocessor mode, which is equivalent to
|
| 293 |
|
|
TMO, and TMO in multiprocessor mode. But they reserve the right to
|
| 294 |
|
|
change their minds. */
|
| 295 |
|
|
#undef SPARC_RELAXED_ORDERING
|
| 296 |
|
|
#define SPARC_RELAXED_ORDERING true
|
| 297 |
|
|
|
| 298 |
|
|
#undef NEED_INDICATE_EXEC_STACK
|
| 299 |
|
|
#define NEED_INDICATE_EXEC_STACK 1
|
| 300 |
|
|
|
| 301 |
|
|
#ifdef TARGET_LIBC_PROVIDES_SSP
|
| 302 |
|
|
/* sparc glibc provides __stack_chk_guard in [%g7 + 0x14],
|
| 303 |
|
|
sparc64 glibc provides it at [%g7 + 0x28]. */
|
| 304 |
|
|
#define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14)
|
| 305 |
|
|
#endif
|
| 306 |
|
|
|
| 307 |
|
|
/* Define if long doubles should be mangled as 'g'. */
|
| 308 |
|
|
#define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
|
| 309 |
|
|
|
| 310 |
|
|
/* We use glibc _mcount for profiling. */
|
| 311 |
|
|
#undef NO_PROFILE_COUNTERS
|
| 312 |
|
|
#define NO_PROFILE_COUNTERS 1
|