Remove LIB_TLS_SPEC on Solaris
[official-gcc.git] / gcc / config / sol2.h
bloba21c953b0359b899b0492228f1e601734e5bf171
1 /* Operating system specific defines to be used when targeting GCC for any
2 Solaris 2 system.
3 Copyright (C) 2002-2014 Free Software Foundation, Inc.
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 /* We are compiling for Solaris 2 now. */
22 #define TARGET_SOLARIS 1
24 /* Solaris 2 (at least as of 2.5.1) uses a 32-bit wchar_t. */
25 #undef WCHAR_TYPE
26 #define WCHAR_TYPE "long int"
28 #undef WCHAR_TYPE_SIZE
29 #define WCHAR_TYPE_SIZE BITS_PER_WORD
31 /* Solaris 2 uses a wint_t different from the default. This is required
32 by the SCD 2.4.1, p. 6-83, Figure 6-66. */
33 #undef WINT_TYPE
34 #define WINT_TYPE "long int"
36 #undef WINT_TYPE_SIZE
37 #define WINT_TYPE_SIZE BITS_PER_WORD
39 #define SIG_ATOMIC_TYPE "int"
41 /* ??? This definition of int8_t follows the system header but does
42 not conform to C99. Likewise int_fast8_t, int_least8_t. */
43 #define INT8_TYPE "char"
44 #define INT16_TYPE "short int"
45 #define INT32_TYPE "int"
46 #define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
47 #define UINT8_TYPE "unsigned char"
48 #define UINT16_TYPE "short unsigned int"
49 #define UINT32_TYPE "unsigned int"
50 #define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
52 #define INT_LEAST8_TYPE "char"
53 #define INT_LEAST16_TYPE "short int"
54 #define INT_LEAST32_TYPE "int"
55 #define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
56 #define UINT_LEAST8_TYPE "unsigned char"
57 #define UINT_LEAST16_TYPE "short unsigned int"
58 #define UINT_LEAST32_TYPE "unsigned int"
59 #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
61 #define INT_FAST8_TYPE "char"
62 #define INT_FAST16_TYPE "int"
63 #define INT_FAST32_TYPE "int"
64 #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
65 #define UINT_FAST8_TYPE "unsigned char"
66 #define UINT_FAST16_TYPE "unsigned int"
67 #define UINT_FAST32_TYPE "unsigned int"
68 #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
70 #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
71 #define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
73 #undef CPP_SUBTARGET_SPEC
74 #define CPP_SUBTARGET_SPEC "\
75 %{pthreads|pthread:-D_REENTRANT -D_PTHREADS}"
77 /* Names to predefine in the preprocessor for this target machine. */
78 #define TARGET_SUB_OS_CPP_BUILTINS()
79 #define TARGET_OS_CPP_BUILTINS() \
80 do { \
81 builtin_define_std ("unix"); \
82 builtin_define_std ("sun"); \
83 builtin_define ("__svr4__"); \
84 builtin_define ("__SVR4"); \
85 builtin_assert ("system=unix"); \
86 builtin_assert ("system=svr4"); \
87 /* For C++ we need to add some additional macro \
88 definitions required by the C++ standard \
89 library. */ \
90 if (c_dialect_cxx ()) \
91 { \
92 builtin_define ("__STDC_VERSION__=199901L");\
93 builtin_define ("_XOPEN_SOURCE=600"); \
94 builtin_define ("_LARGEFILE_SOURCE=1"); \
95 builtin_define ("_LARGEFILE64_SOURCE=1"); \
96 builtin_define ("__EXTENSIONS__"); \
97 } \
98 TARGET_SUB_OS_CPP_BUILTINS(); \
99 } while (0)
101 #define SUBTARGET_OVERRIDE_OPTIONS \
102 do { \
103 solaris_override_options (); \
104 } while (0)
107 /* It's safe to pass -s always, even if -g is not used. Those options are
108 handled by both Sun as and GNU as. */
109 #define ASM_SPEC_BASE \
110 "%{v:-V} %{Qy:} %{!Qn:-Qy} %{Ym,*} -s %(asm_cpu)"
112 #define ASM_PIC_SPEC " %{fpic|fpie|fPIC|fPIE:-K PIC}"
114 #undef LIB_SPEC
115 #define LIB_SPEC \
116 "%{!symbolic:\
117 %{pthreads|pthread:-lpthread} \
118 %{p|pg:-ldl} -lc}"
120 #ifndef CROSS_DIRECTORY_STRUCTURE
121 #undef MD_EXEC_PREFIX
122 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
124 #undef MD_STARTFILE_PREFIX
125 #define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
126 #endif
128 #undef STARTFILE_ARCH32_SPEC
129 #define STARTFILE_ARCH32_SPEC "%{ansi:values-Xc.o%s} \
130 %{!ansi:values-Xa.o%s}"
132 #undef STARTFILE_ARCH_SPEC
133 #define STARTFILE_ARCH_SPEC STARTFILE_ARCH32_SPEC
135 /* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. */
136 #undef STARTFILE_SPEC
137 #define STARTFILE_SPEC "%{!shared: \
138 %{!symbolic: \
139 %{p:mcrt1.o%s} \
140 %{!p: \
141 %{pg:gcrt1.o%s gmon.o%s} \
142 %{!pg:crt1.o%s}}}} \
143 crti.o%s %(startfile_arch) \
144 crtbegin.o%s"
146 #undef ENDFILE_SPEC
147 #define ENDFILE_SPEC \
148 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
149 crtend.o%s crtn.o%s"
151 #undef LINK_ARCH32_SPEC_BASE
152 #define LINK_ARCH32_SPEC_BASE \
153 "%{G:-G} \
154 %{YP,*} \
155 %{R*} \
156 %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/lib:%R/usr/lib} \
157 %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/lib:%R/usr/lib}}}"
159 #undef LINK_ARCH32_SPEC
160 #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
162 #undef LINK_ARCH_SPEC
163 #define LINK_ARCH_SPEC LINK_ARCH32_SPEC
165 /* C++11 programs need -lrt for nanosleep. */
166 #define TIME_LIBRARY "rt"
168 #ifndef USE_GLD
169 /* With Sun ld, -rdynamic is a no-op. */
170 #define RDYNAMIC_SPEC ""
171 #else
172 /* GNU ld needs --export-dynamic to implement -rdynamic. */
173 #define RDYNAMIC_SPEC "--export-dynamic"
174 #endif
176 #ifndef USE_GLD
177 /* With Sun ld, use mapfile to enforce direct binding to libgcc_s unwinder. */
178 #define LINK_LIBGCC_MAPFILE_SPEC \
179 "%{shared|shared-libgcc:-M %slibgcc-unwind.map}"
180 #else
181 /* GNU ld doesn't support direct binding. */
182 #define LINK_LIBGCC_MAPFILE_SPEC ""
183 #endif
185 #undef LINK_SPEC
186 #define LINK_SPEC \
187 "%{h*} %{v:-V} \
188 %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \
189 %{static:-dn -Bstatic} \
190 %{shared:-G -dy %{!mimpure-text:-z text}} " LINK_LIBGCC_MAPFILE_SPEC " \
191 %{symbolic:-Bsymbolic -G -dy -z text} \
192 %(link_arch) \
193 %{Qy:} %{!Qn:-Qy}"
195 /* Use --as-needed/-z ignore -lgcc_s for eh support. */
196 #ifdef HAVE_LD_AS_NEEDED
197 #define USE_LD_AS_NEEDED 1
198 #endif
200 #ifdef USE_GLD
201 /* Solaris 11 build 135+ implements dl_iterate_phdr. GNU ld needs
202 --eh-frame-hdr to create the required .eh_frame_hdr sections. */
203 #if defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR)
204 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
205 #endif /* HAVE_LD_EH_FRAME && TARGET_DL_ITERATE_PHDR */
206 #endif
208 /* collect2.c can only parse GNU nm -n output. Solaris nm needs -png to
209 produce the same format. */
210 #define NM_FLAGS "-png"
212 /* The system headers under Solaris 2 are C++-aware since 2.0. */
213 #define NO_IMPLICIT_EXTERN_C
215 #define STDC_0_IN_SYSTEM_HEADERS 1
217 /* Support Solaris-specific format checking for cmn_err. */
218 #define TARGET_N_FORMAT_TYPES 1
219 #define TARGET_FORMAT_TYPES solaris_format_types
221 /* #pragma init and #pragma fini are implemented on top of init and
222 fini attributes. */
223 #define SOLARIS_ATTRIBUTE_TABLE \
224 { "init", 0, 0, true, false, false, NULL, false }, \
225 { "fini", 0, 0, true, false, false, NULL, false }
227 /* Solaris-specific #pragmas are implemented on top of attributes. Hook in
228 the bits from config/sol2.c. */
229 #define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes
230 #define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE
232 /* Allow macro expansion in #pragma pack. */
233 #define HANDLE_PRAGMA_PACK_WITH_EXPANSION
235 #define TARGET_CXX_DECL_MANGLING_CONTEXT solaris_cxx_decl_mangling_context
237 /* Solaris/x86 as and gas support unquoted section names. */
238 #define SECTION_NAME_FORMAT "%s"
240 /* This is how to declare the size of a function. For Solaris, we output
241 any .init or .fini entries here. */
242 #undef ASM_DECLARE_FUNCTION_SIZE
243 #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
244 do \
246 if (!flag_inhibit_size_directive) \
247 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
248 solaris_output_init_fini (FILE, DECL); \
250 while (0)
252 /* Solaris as has a bug: a .common directive in .tbss or .tdata section
253 behaves as .tls_common rather than normal non-TLS .common. */
254 #undef ASM_OUTPUT_ALIGNED_COMMON
255 #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
256 do \
258 if (TARGET_SUN_TLS \
259 && in_section \
260 && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \
261 switch_to_section (bss_section); \
262 fprintf ((FILE), "%s", COMMON_ASM_OP); \
263 assemble_name ((FILE), (NAME)); \
264 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
265 (SIZE), (ALIGN) / BITS_PER_UNIT); \
267 while (0)
269 #ifndef USE_GAS
270 #undef TARGET_ASM_ASSEMBLE_VISIBILITY
271 #define TARGET_ASM_ASSEMBLE_VISIBILITY solaris_assemble_visibility
273 #define AS_NEEDS_DASH_FOR_PIPED_INPUT
275 /* The Solaris assembler cannot grok .stabd directives. */
276 #undef NO_DBX_BNSYM_ENSYM
277 #define NO_DBX_BNSYM_ENSYM 1
278 #endif
280 #ifndef USE_GLD
281 /* The Solaris linker doesn't understand constructor priorities. */
282 #undef SUPPORTS_INIT_PRIORITY
283 #define SUPPORTS_INIT_PRIORITY 0
284 #endif
286 /* Solaris has an implementation of __enable_execute_stack. */
287 #define HAVE_ENABLE_EXECUTE_STACK
289 /* Static stack checking is supported by means of probes. */
290 #define STACK_CHECK_STATIC_BUILTIN 1
292 #define TARGET_POSIX_IO
294 #undef TARGET_LIBC_HAS_FUNCTION
295 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
297 extern GTY(()) tree solaris_pending_aligns;
298 extern GTY(()) tree solaris_pending_inits;
299 extern GTY(()) tree solaris_pending_finis;