2015-05-05 Yvan Roux <yvan.roux@linaro.org>
[official-gcc.git] / gcc / config / sparc / linux.h
blob56def4bcd4738a3ffd1430a7effb7792fc0b7e81
1 /* Definitions for SPARC running Linux-based GNU systems with ELF.
2 Copyright (C) 1996-2015 Free Software Foundation, Inc.
3 Contributed by Eddie C. Dost (ecd@skynet.be)
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #define TARGET_OS_CPP_BUILTINS() \
22 do \
23 { \
24 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
25 if (TARGET_LONG_DOUBLE_128) \
26 builtin_define ("__LONG_DOUBLE_128__"); \
27 } \
28 while (0)
30 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
31 the GNU/Linux magical crtend.o file (see crtstuff.c) which
32 provides part of the support for getting C++ file-scope static
33 object constructed before entering `main', followed by a normal
34 GNU/Linux "finalizer" file, `crtn.o'. */
36 #undef ENDFILE_SPEC
37 #define ENDFILE_SPEC \
38 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
39 %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
41 /* -mcpu=native handling only makes sense with compiler running on
42 a SPARC chip. */
43 #if defined(__sparc__) && defined(__linux__)
44 extern const char *host_detect_local_cpu (int argc, const char **argv);
45 # define EXTRA_SPEC_FUNCTIONS \
46 { "local_cpu_detect", host_detect_local_cpu },
48 # define MCPU_MTUNE_NATIVE_SPECS \
49 " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \
50 " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
51 #else
52 # define MCPU_MTUNE_NATIVE_SPECS ""
53 #endif
55 #define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
57 /* This is for -profile to use -lc_p instead of -lc. */
58 #undef CC1_SPEC
59 #define CC1_SPEC "%{profile:-p} \
62 #undef SIZE_TYPE
63 #define SIZE_TYPE "unsigned int"
65 #undef PTRDIFF_TYPE
66 #define PTRDIFF_TYPE "int"
68 #undef WCHAR_TYPE
69 #define WCHAR_TYPE "int"
71 #undef WCHAR_TYPE_SIZE
72 #define WCHAR_TYPE_SIZE 32
74 #undef CPP_SUBTARGET_SPEC
75 #define CPP_SUBTARGET_SPEC \
76 "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
78 /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
79 for the special GCC options -static and -shared, which allow us to
80 link things in one of these three modes by applying the appropriate
81 combinations of options at link-time.
83 When the -shared link option is used a final link is not being
84 done. */
86 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
88 #undef LINK_SPEC
89 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
90 %{!mno-relax:%{!r:-relax}} \
91 %{!shared: \
92 %{!static: \
93 %{rdynamic:-export-dynamic} \
94 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
95 %{static:-static}}"
97 /* It's safe to pass -s always, even if -g is not used. */
98 #undef ASM_SPEC
99 #define ASM_SPEC "\
100 -s \
101 %{fpic|fPIC|fpie|fPIE:-K PIC} \
102 %{!.c:%{findirect-dispatch:-K PIC}} \
103 %(asm_cpu) %(asm_relax)"
105 #undef ASM_OUTPUT_ALIGNED_LOCAL
106 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
107 do { \
108 fputs ("\t.local\t", (FILE)); \
109 assemble_name ((FILE), (NAME)); \
110 putc ('\n', (FILE)); \
111 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
112 } while (0)
114 #undef COMMON_ASM_OP
115 #define COMMON_ASM_OP "\t.common\t"
117 #undef LOCAL_LABEL_PREFIX
118 #define LOCAL_LABEL_PREFIX "."
121 /* Define for support of TFmode long double.
122 SPARC ABI says that long double is 4 words. */
123 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
125 #undef DITF_CONVERSION_LIBFUNCS
126 #define DITF_CONVERSION_LIBFUNCS 1
128 #ifdef HAVE_AS_TLS
129 #undef TARGET_SUN_TLS
130 #undef TARGET_GNU_TLS
131 #define TARGET_SUN_TLS 0
132 #define TARGET_GNU_TLS 1
133 #endif
135 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
136 #undef CTORS_SECTION_ASM_OP
137 #undef DTORS_SECTION_ASM_OP
139 /* Static stack checking is supported by means of probes. */
140 #define STACK_CHECK_STATIC_BUILTIN 1
142 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
143 TMO, and TMO in multiprocessor mode. But they reserve the right to
144 change their minds. */
145 #undef SPARC_RELAXED_ORDERING
146 #define SPARC_RELAXED_ORDERING true
148 #undef NEED_INDICATE_EXEC_STACK
149 #define NEED_INDICATE_EXEC_STACK 1
151 #ifdef TARGET_LIBC_PROVIDES_SSP
152 /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */
153 #define TARGET_THREAD_SSP_OFFSET 0x14
154 #endif
156 /* Define if long doubles should be mangled as 'g'. */
157 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
159 /* We use glibc _mcount for profiling. */
160 #undef NO_PROFILE_COUNTERS
161 #define NO_PROFILE_COUNTERS 1