Add sparc vec_perm patterns when VIS2.
[gcc.git] / gcc / config / sparc / linux.h
1 /* Definitions for SPARC running Linux-based GNU systems with ELF.
2 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
3 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4 Contributed by Eddie C. Dost (ecd@skynet.be)
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_LONG_DOUBLE_128) \
27 builtin_define ("__LONG_DOUBLE_128__"); \
28 } \
29 while (0)
30
31 /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on
32 the GNU/Linux magical crtend.o file (see crtstuff.c) which
33 provides part of the support for getting C++ file-scope static
34 object constructed before entering `main', followed by a normal
35 GNU/Linux "finalizer" file, `crtn.o'. */
36
37 #undef ENDFILE_SPEC
38 #define ENDFILE_SPEC \
39 "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s\
40 %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s}"
41
42 /* -mcpu=native handling only makes sense with compiler running on
43 a SPARC chip. */
44 #if defined(__sparc__) && defined(__linux__)
45 extern const char *host_detect_local_cpu (int argc, const char **argv);
46 # define EXTRA_SPEC_FUNCTIONS \
47 { "local_cpu_detect", host_detect_local_cpu },
48
49 # define MCPU_MTUNE_NATIVE_SPECS \
50 " %{mcpu=native:%<mcpu=native %:local_cpu_detect(cpu)}" \
51 " %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
52 #else
53 # define MCPU_MTUNE_NATIVE_SPECS ""
54 #endif
55
56 #define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS
57
58 /* This is for -profile to use -lc_p instead of -lc. */
59 #undef CC1_SPEC
60 #define CC1_SPEC "%{profile:-p} \
61 "
62
63 #undef SIZE_TYPE
64 #define SIZE_TYPE "unsigned int"
65
66 #undef PTRDIFF_TYPE
67 #define PTRDIFF_TYPE "int"
68
69 #undef WCHAR_TYPE
70 #define WCHAR_TYPE "int"
71
72 #undef WCHAR_TYPE_SIZE
73 #define WCHAR_TYPE_SIZE 32
74
75 #undef CPP_SUBTARGET_SPEC
76 #define CPP_SUBTARGET_SPEC \
77 "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
78
79 /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support
80 for the special GCC options -static and -shared, which allow us to
81 link things in one of these three modes by applying the appropriate
82 combinations of options at link-time.
83
84 When the -shared link option is used a final link is not being
85 done. */
86
87 #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
88
89 #undef LINK_SPEC
90 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
91 %{!mno-relax:%{!r:-relax}} \
92 %{!shared: \
93 %{!static: \
94 %{rdynamic:-export-dynamic} \
95 -dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
96 %{static:-static}}"
97
98 /* It's safe to pass -s always, even if -g is not used. */
99 #undef ASM_SPEC
100 #define ASM_SPEC "\
101 -s \
102 %{fpic|fPIC|fpie|fPIE:-K PIC} \
103 %{!.c:%{findirect-dispatch:-K PIC}} \
104 %(asm_cpu) %(asm_relax)"
105
106 #undef ASM_OUTPUT_ALIGNED_LOCAL
107 #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
108 do { \
109 fputs ("\t.local\t", (FILE)); \
110 assemble_name ((FILE), (NAME)); \
111 putc ('\n', (FILE)); \
112 ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
113 } while (0)
114
115 #undef COMMON_ASM_OP
116 #define COMMON_ASM_OP "\t.common\t"
117
118 #undef LOCAL_LABEL_PREFIX
119 #define LOCAL_LABEL_PREFIX "."
120
121 /* This is how to store into the string LABEL
122 the symbol_ref name of an internal numbered label where
123 PREFIX is the class of label and NUM is the number within the class.
124 This is suitable for output with `assemble_name'. */
125
126 #undef ASM_GENERATE_INTERNAL_LABEL
127 #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
128 sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM))
129
130 \f
131 /* Define for support of TFmode long double.
132 SPARC ABI says that long double is 4 words. */
133 #define LONG_DOUBLE_TYPE_SIZE (TARGET_LONG_DOUBLE_128 ? 128 : 64)
134
135 /* Define this to set long double type size to use in libgcc2.c, which can
136 not depend on target_flags. */
137 #ifdef __LONG_DOUBLE_128__
138 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128
139 #else
140 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
141 #endif
142
143 #undef DITF_CONVERSION_LIBFUNCS
144 #define DITF_CONVERSION_LIBFUNCS 1
145 \f
146 #ifdef HAVE_AS_TLS
147 #undef TARGET_SUN_TLS
148 #undef TARGET_GNU_TLS
149 #define TARGET_SUN_TLS 0
150 #define TARGET_GNU_TLS 1
151 #endif
152 \f
153 /* We use GNU ld so undefine this so that attribute((init_priority)) works. */
154 #undef CTORS_SECTION_ASM_OP
155 #undef DTORS_SECTION_ASM_OP
156
157 /* Static stack checking is supported by means of probes. */
158 #define STACK_CHECK_STATIC_BUILTIN 1
159
160 /* Linux currently uses RMO in uniprocessor mode, which is equivalent to
161 TMO, and TMO in multiprocessor mode. But they reserve the right to
162 change their minds. */
163 #undef SPARC_RELAXED_ORDERING
164 #define SPARC_RELAXED_ORDERING true
165
166 #undef NEED_INDICATE_EXEC_STACK
167 #define NEED_INDICATE_EXEC_STACK 1
168
169 #ifdef TARGET_LIBC_PROVIDES_SSP
170 /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */
171 #define TARGET_THREAD_SSP_OFFSET 0x14
172 #endif
173
174 /* Define if long doubles should be mangled as 'g'. */
175 #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
176
177 /* We use glibc _mcount for profiling. */
178 #undef NO_PROFILE_COUNTERS
179 #define NO_PROFILE_COUNTERS 1