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