]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/sol2.h
netbsd.h (ENABLE_EXECUTE_STACK): Remove.
[thirdparty/gcc.git] / gcc / config / sol2.h
CommitLineData
8433a25e
RO
1/* Operating system specific defines to be used when targeting GCC for any
2 Solaris 2 system.
12eb1a9c 3 Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011
f1c26cad 4 Free Software Foundation, Inc.
8433a25e 5
814499a4 6This file is part of GCC.
8433a25e 7
814499a4 8GCC is free software; you can redistribute it and/or modify
8433a25e 9it under the terms of the GNU General Public License as published by
2f83c7d6 10the Free Software Foundation; either version 3, or (at your option)
8433a25e
RO
11any later version.
12
814499a4 13GCC is distributed in the hope that it will be useful,
8433a25e
RO
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
2f83c7d6
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
8433a25e 21
2ca48caa
RO
22/* We are compiling for Solaris 2 now. */
23#define TARGET_SOLARIS 1
24
8433a25e
RO
25/* We use stabs-in-elf for debugging, because that is what the native
26 toolchain uses. */
27#undef PREFERRED_DEBUGGING_TYPE
28#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
29
30/* Solaris 2 (at least as of 2.5.1) uses a 32-bit wchar_t. */
31#undef WCHAR_TYPE
32#define WCHAR_TYPE "long int"
33
34#undef WCHAR_TYPE_SIZE
35#define WCHAR_TYPE_SIZE BITS_PER_WORD
36
37/* Solaris 2 uses a wint_t different from the default. This is required
38 by the SCD 2.4.1, p. 6-83, Figure 6-66. */
39#undef WINT_TYPE
40#define WINT_TYPE "long int"
41
42#undef WINT_TYPE_SIZE
43#define WINT_TYPE_SIZE BITS_PER_WORD
44
207bf79d
JM
45#define SIG_ATOMIC_TYPE "int"
46
47/* ??? This definition of int8_t follows the system header but does
48 not conform to C99. Likewise int_fast8_t, int_least8_t. */
49#define INT8_TYPE "char"
50#define INT16_TYPE "short int"
51#define INT32_TYPE "int"
52#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
53#define UINT8_TYPE "unsigned char"
54#define UINT16_TYPE "short unsigned int"
55#define UINT32_TYPE "unsigned int"
56#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
57
58#define INT_LEAST8_TYPE "char"
59#define INT_LEAST16_TYPE "short int"
60#define INT_LEAST32_TYPE "int"
61#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
62#define UINT_LEAST8_TYPE "unsigned char"
63#define UINT_LEAST16_TYPE "short unsigned int"
64#define UINT_LEAST32_TYPE "unsigned int"
65#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
66
67#define INT_FAST8_TYPE "char"
68#define INT_FAST16_TYPE "int"
69#define INT_FAST32_TYPE "int"
70#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
71#define UINT_FAST8_TYPE "unsigned char"
72#define UINT_FAST16_TYPE "unsigned int"
73#define UINT_FAST32_TYPE "unsigned int"
74#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
75
76#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
77#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
78
8433a25e
RO
79/* ??? Note: in order for -compat-bsd to work fully,
80 we must somehow arrange to fixincludes /usr/ucbinclude
81 and put the result in $(libsubdir)/ucbinclude. */
82
83#undef CPP_SUBTARGET_SPEC
84#define CPP_SUBTARGET_SPEC "\
f5e2061b 85%{pthreads|pthread:-D_REENTRANT -D_PTHREADS} \
8433a25e
RO
86%{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude} \
87"
88
89/* Names to predefine in the preprocessor for this target machine. */
6508bdd5 90#define TARGET_SUB_OS_CPP_BUILTINS()
8433a25e
RO
91#define TARGET_OS_CPP_BUILTINS() \
92 do { \
93 builtin_define_std ("unix"); \
94 builtin_define_std ("sun"); \
95 builtin_define ("__svr4__"); \
96 builtin_define ("__SVR4"); \
8433a25e
RO
97 builtin_assert ("system=unix"); \
98 builtin_assert ("system=svr4"); \
6508bdd5 99 /* For C++ we need to add some additional macro \
8433a25e
RO
100 definitions required by the C++ standard \
101 library. */ \
04df6730 102 if (c_dialect_cxx ()) \
8433a25e 103 { \
babc4728
RO
104 builtin_define ("__STDC_VERSION__=199901L");\
105 builtin_define ("_XOPEN_SOURCE=600"); \
8433a25e
RO
106 builtin_define ("_LARGEFILE_SOURCE=1"); \
107 builtin_define ("_LARGEFILE64_SOURCE=1"); \
108 builtin_define ("__EXTENSIONS__"); \
109 } \
6508bdd5 110 TARGET_SUB_OS_CPP_BUILTINS(); \
8433a25e
RO
111 } while (0)
112
b689848f 113/* The system headers under Solaris 2 are C++-aware since 2.0. */
49fa0661
JM
114#define NO_IMPLICIT_EXTERN_C
115
12eb1a9c 116/* It's safe to pass -s always, even if -g is not used. */
8433a25e
RO
117#undef ASM_SPEC
118#define ASM_SPEC "\
51769cc0 119%{v:-V} %{Qy:} %{!Qn:-Qy} %{Ym,*} -s \
24a4dd31 120%{fpic|fpie|fPIC|fPIE:-K PIC} \
8433a25e
RO
121%(asm_cpu) \
122"
123
72b7f7ea
JM
124#ifndef CROSS_DIRECTORY_STRUCTURE
125#undef MD_EXEC_PREFIX
126#define MD_EXEC_PREFIX "/usr/ccs/bin/"
127
128#undef MD_STARTFILE_PREFIX
129#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
130#endif
131
8433a25e
RO
132/* We don't use the standard LIB_SPEC only because we don't yet support c++. */
133#undef LIB_SPEC
134#define LIB_SPEC \
135 "%{compat-bsd:-lucb -lsocket -lnsl -lelf -laio} \
16c9d3b1
RO
136 %{!symbolic:\
137 %{pthreads|pthread:" \
138 LIB_THREAD_LDFLAGS_SPEC " -lpthread " LIB_TLS_SPEC "} \
ee0cb37c
EB
139 %{fprofile-generate*:" \
140 LIB_THREAD_LDFLAGS_SPEC " " LIB_TLS_SPEC "} \
16c9d3b1 141 %{p|pg:-ldl} -lc}"
8433a25e
RO
142
143#undef ENDFILE_SPEC
0699e415
RO
144#define ENDFILE_SPEC \
145 "%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
146 crtend.o%s crtn.o%s"
8433a25e
RO
147
148/* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. */
149#undef STARTFILE_SPEC
150#define STARTFILE_SPEC "%{!shared: \
151 %{!symbolic: \
152 %{p:mcrt1.o%s} \
153 %{!p: \
154 %{pg:gcrt1.o%s gmon.o%s} \
155 %{!pg:crt1.o%s}}}} \
156 crti.o%s %(startfile_arch) \
157 crtbegin.o%s"
158
159#undef STARTFILE_ARCH32_SPEC
160#define STARTFILE_ARCH32_SPEC "%{ansi:values-Xc.o%s} \
161 %{!ansi:values-Xa.o%s}"
162
163#undef STARTFILE_ARCH_SPEC
164#define STARTFILE_ARCH_SPEC STARTFILE_ARCH32_SPEC
165
61aaea23
MM
166#undef LINK_ARCH32_SPEC_BASE
167#define LINK_ARCH32_SPEC_BASE \
8433a25e
RO
168 "%{G:-G} \
169 %{YP,*} \
170 %{R*} \
171 %{compat-bsd: \
50617257
JM
172 %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
173 %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/usr/lib}}} \
174 -R %R/usr/ucblib} \
8433a25e 175 %{!compat-bsd: \
50617257
JM
176 %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
177 %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/usr/lib}}}}"
8433a25e 178
61aaea23
MM
179#undef LINK_ARCH32_SPEC
180#define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
181
8433a25e
RO
182#undef LINK_ARCH_SPEC
183#define LINK_ARCH_SPEC LINK_ARCH32_SPEC
184
8433a25e
RO
185#undef LINK_SPEC
186#define LINK_SPEC \
187 "%{h*} %{v:-V} \
fcf52686 188 %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \
8433a25e
RO
189 %{static:-dn -Bstatic} \
190 %{shared:-G -dy %{!mimpure-text:-z text}} \
191 %{symbolic:-Bsymbolic -G -dy -z text} \
192 %(link_arch) \
193 %{Qy:} %{!Qn:-Qy}"
194
fcf52686
RO
195/* With Sun ld, -rdynamic is a no-op. */
196#define RDYNAMIC_SPEC ""
197
6e70657a
MM
198/* The Solaris linker doesn't understand constructor priorities. (The
199 GNU linker does support constructor priorities, so GNU ld
200 configuration files for Solaris override this setting.) */
201#undef SUPPORTS_INIT_PRIORITY
202#define SUPPORTS_INIT_PRIORITY 0
203
3e794bfe
RO
204/* collect2.c can only parse GNU nm -n output. Solaris nm needs -png to
205 produce the same format. */
206#define NM_FLAGS "-png"
207
8433a25e
RO
208#define STDC_0_IN_SYSTEM_HEADERS 1
209\f
10e48e39 210#define HAVE_ENABLE_EXECUTE_STACK
a2bec818 211
07a43492 212/* Support Solaris-specific format checking for cmn_err. */
a2bec818
DJ
213#define TARGET_N_FORMAT_TYPES 1
214#define TARGET_FORMAT_TYPES solaris_format_types
07a43492
DJ
215
216/* #pragma init and #pragma fini are implemented on top of init and
217 fini attributes. */
218#define SOLARIS_ATTRIBUTE_TABLE \
62d784f7
KT
219 { "init", 0, 0, true, false, false, NULL, false }, \
220 { "fini", 0, 0, true, false, false, NULL, false }
07a43492 221
2ca48caa
RO
222/* Solaris/x86 as and gas support unquoted section names. */
223#define SECTION_NAME_FORMAT "%s"
a0c21029 224
07a43492
DJ
225/* This is how to declare the size of a function. For Solaris, we output
226 any .init or .fini entries here. */
227#undef ASM_DECLARE_FUNCTION_SIZE
228#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
229 do \
230 { \
231 if (!flag_inhibit_size_directive) \
232 ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \
233 solaris_output_init_fini (FILE, DECL); \
234 } \
235 while (0)
236
adb75db0 237/* Solaris 'as' has a bug: a .common directive in .tbss or .tdata section
f1c26cad
RO
238 behaves as .tls_common rather than normal non-TLS .common. */
239#undef ASM_OUTPUT_ALIGNED_COMMON
240#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
241 do \
242 { \
243 if (TARGET_SUN_TLS \
244 && in_section \
adb75db0 245 && ((in_section->common.flags & SECTION_TLS) == SECTION_TLS)) \
f1c26cad
RO
246 switch_to_section (bss_section); \
247 fprintf ((FILE), "%s", COMMON_ASM_OP); \
248 assemble_name ((FILE), (NAME)); \
249 fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
250 (SIZE), (ALIGN) / BITS_PER_UNIT); \
251 } \
252 while (0)
253
f0c01ffd
RO
254#ifndef USE_GAS
255#undef TARGET_ASM_ASSEMBLE_VISIBILITY
256#define TARGET_ASM_ASSEMBLE_VISIBILITY solaris_assemble_visibility
b8f9bca0
JM
257
258#define AS_NEEDS_DASH_FOR_PIPED_INPUT
259
f0c01ffd
RO
260#endif
261
07a43492
DJ
262extern GTY(()) tree solaris_pending_aligns;
263extern GTY(()) tree solaris_pending_inits;
264extern GTY(()) tree solaris_pending_finis;
b5b3e36a
DJ
265
266/* Allow macro expansion in #pragma pack. */
267#define HANDLE_PRAGMA_PACK_WITH_EXPANSION
9c0c4ec7
JM
268
269#define TARGET_POSIX_IO