]>
Commit | Line | Data |
---|---|---|
8433a25e RO |
1 | /* Operating system specific defines to be used when targeting GCC for any |
2 | Solaris 2 system. | |
aeee4812 | 3 | Copyright (C) 2002-2023 Free Software Foundation, Inc. |
8433a25e | 4 | |
814499a4 | 5 | This file is part of GCC. |
8433a25e | 6 | |
814499a4 | 7 | GCC is free software; you can redistribute it and/or modify |
8433a25e | 8 | it under the terms of the GNU General Public License as published by |
2f83c7d6 | 9 | the Free Software Foundation; either version 3, or (at your option) |
8433a25e RO |
10 | any later version. |
11 | ||
814499a4 | 12 | GCC is distributed in the hope that it will be useful, |
8433a25e RO |
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. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
2f83c7d6 NC |
18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
8433a25e | 20 | |
2ca48caa RO |
21 | /* We are compiling for Solaris 2 now. */ |
22 | #define TARGET_SOLARIS 1 | |
23 | ||
2cf03b11 RO |
24 | /* wchar_t is called differently in <wchar.h> for 32 and 64-bit |
25 | compilations. This is called for by SCD 2.4.1, p. 6-83, Figure 6-65 | |
26 | (32-bit) and p. 6P-10, Figure 6.38 (64-bit). */ | |
27 | ||
8433a25e | 28 | #undef WCHAR_TYPE |
2cf03b11 | 29 | #define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") |
8433a25e RO |
30 | |
31 | #undef WCHAR_TYPE_SIZE | |
2cf03b11 RO |
32 | #define WCHAR_TYPE_SIZE 32 |
33 | ||
34 | /* Same for wint_t. See SCD 2.4.1, p. 6-83, Figure 6-66 (32-bit). There's | |
35 | no corresponding 64-bit definition, but this is what Solaris 8 | |
36 | <iso/wchar_iso.h> uses. */ | |
8433a25e | 37 | |
2cf03b11 RO |
38 | #undef WINT_TYPE |
39 | #define WINT_TYPE (TARGET_64BIT ? "int" : "long int") | |
8433a25e | 40 | |
2cf03b11 RO |
41 | #undef WINT_TYPE_SIZE |
42 | #define WINT_TYPE_SIZE 32 | |
8433a25e | 43 | |
207bf79d JM |
44 | #define SIG_ATOMIC_TYPE "int" |
45 | ||
46 | /* ??? This definition of int8_t follows the system header but does | |
47 | not conform to C99. Likewise int_fast8_t, int_least8_t. */ | |
48 | #define INT8_TYPE "char" | |
49 | #define INT16_TYPE "short int" | |
50 | #define INT32_TYPE "int" | |
51 | #define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") | |
52 | #define UINT8_TYPE "unsigned char" | |
53 | #define UINT16_TYPE "short unsigned int" | |
54 | #define UINT32_TYPE "unsigned int" | |
55 | #define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") | |
56 | ||
57 | #define INT_LEAST8_TYPE "char" | |
58 | #define INT_LEAST16_TYPE "short int" | |
59 | #define INT_LEAST32_TYPE "int" | |
60 | #define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") | |
61 | #define UINT_LEAST8_TYPE "unsigned char" | |
62 | #define UINT_LEAST16_TYPE "short unsigned int" | |
63 | #define UINT_LEAST32_TYPE "unsigned int" | |
64 | #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") | |
65 | ||
66 | #define INT_FAST8_TYPE "char" | |
67 | #define INT_FAST16_TYPE "int" | |
68 | #define INT_FAST32_TYPE "int" | |
69 | #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") | |
70 | #define UINT_FAST8_TYPE "unsigned char" | |
71 | #define UINT_FAST16_TYPE "unsigned int" | |
72 | #define UINT_FAST32_TYPE "unsigned int" | |
73 | #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") | |
74 | ||
75 | #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") | |
76 | #define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int") | |
77 | ||
8433a25e RO |
78 | #undef CPP_SUBTARGET_SPEC |
79 | #define CPP_SUBTARGET_SPEC "\ | |
7ecfa34f | 80 | %{pthreads|pthread:-D_REENTRANT -D_PTHREADS}" |
8433a25e RO |
81 | |
82 | /* Names to predefine in the preprocessor for this target machine. */ | |
6508bdd5 | 83 | #define TARGET_SUB_OS_CPP_BUILTINS() |
8433a25e | 84 | #define TARGET_OS_CPP_BUILTINS() \ |
acd8b8dc RO |
85 | do { \ |
86 | builtin_define_std ("unix"); \ | |
87 | builtin_define_std ("sun"); \ | |
88 | builtin_define ("__svr4__"); \ | |
89 | builtin_define ("__SVR4"); \ | |
90 | builtin_assert ("system=unix"); \ | |
91 | builtin_assert ("system=svr4"); \ | |
92 | /* For C++ we need to add some additional macro \ | |
93 | definitions required by the C++ standard \ | |
94 | library. */ \ | |
95 | if (c_dialect_cxx ()) \ | |
96 | { \ | |
97 | switch (cxx_dialect) \ | |
8433a25e | 98 | { \ |
acd8b8dc RO |
99 | case cxx98: \ |
100 | case cxx11: \ | |
101 | case cxx14: \ | |
102 | /* C++11 and C++14 are based on C99. \ | |
103 | libstdc++ makes use of C99 features \ | |
104 | even for C++98. */ \ | |
babc4728 | 105 | builtin_define ("__STDC_VERSION__=199901L");\ |
acd8b8dc RO |
106 | break; \ |
107 | \ | |
108 | default: \ | |
109 | /* C++17 is based on C11. */ \ | |
110 | builtin_define ("__STDC_VERSION__=201112L");\ | |
111 | break; \ | |
8433a25e | 112 | } \ |
acd8b8dc RO |
113 | builtin_define ("_XOPEN_SOURCE=600"); \ |
114 | builtin_define ("_LARGEFILE_SOURCE=1"); \ | |
115 | builtin_define ("_LARGEFILE64_SOURCE=1"); \ | |
a634048e | 116 | builtin_define ("_FILE_OFFSET_BITS=64"); \ |
acd8b8dc RO |
117 | builtin_define ("__EXTENSIONS__"); \ |
118 | } \ | |
119 | TARGET_SUB_OS_CPP_BUILTINS(); \ | |
120 | } while (0) | |
8433a25e | 121 | |
fe551ce4 RO |
122 | #define SUBTARGET_OVERRIDE_OPTIONS \ |
123 | do { \ | |
124 | solaris_override_options (); \ | |
125 | } while (0) | |
126 | ||
2cf03b11 RO |
127 | #if DEFAULT_ARCH32_P |
128 | #define MULTILIB_DEFAULTS { "m32" } | |
129 | #else | |
130 | #define MULTILIB_DEFAULTS { "m64" } | |
131 | #endif | |
132 | ||
133 | #if DEFAULT_ARCH32_P | |
134 | #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}" | |
135 | #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}" | |
136 | #else | |
137 | #define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}" | |
138 | #define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}" | |
139 | #endif | |
fe551ce4 | 140 | |
aaabfd71 RO |
141 | /* Solaris needs -fasynchronous-unwind-tables to generate unwind info. */ |
142 | #define ASAN_CC1_SPEC "%{%:sanitize(address):-fasynchronous-unwind-tables}" | |
143 | ||
fcf7471a RO |
144 | /* It's safe to pass -s always, even if -g is not used. Those options are |
145 | handled by both Sun as and GNU as. */ | |
146 | #define ASM_SPEC_BASE \ | |
147 | "%{v:-V} %{Qy:} %{!Qn:-Qy} %{Ym,*} -s %(asm_cpu)" | |
148 | ||
428b3812 | 149 | #define ASM_PIC_SPEC " %{" FPIE_OR_FPIC_SPEC ":-K PIC}" |
8433a25e | 150 | |
2cf03b11 RO |
151 | #undef ASM_CPU_DEFAULT_SPEC |
152 | #define ASM_CPU_DEFAULT_SPEC \ | |
153 | (DEFAULT_ARCH32_P ? "\ | |
154 | %{m64:" ASM_CPU64_DEFAULT_SPEC "} \ | |
155 | %{!m64:" ASM_CPU32_DEFAULT_SPEC "} \ | |
156 | " : "\ | |
157 | %{m32:" ASM_CPU32_DEFAULT_SPEC "} \ | |
158 | %{!m32:" ASM_CPU64_DEFAULT_SPEC "} \ | |
159 | ") | |
160 | ||
7ecfa34f RO |
161 | #undef LIB_SPEC |
162 | #define LIB_SPEC \ | |
163 | "%{!symbolic:\ | |
7ecfa34f RO |
164 | %{p|pg:-ldl} -lc}" |
165 | ||
72b7f7ea JM |
166 | #ifndef CROSS_DIRECTORY_STRUCTURE |
167 | #undef MD_EXEC_PREFIX | |
168 | #define MD_EXEC_PREFIX "/usr/ccs/bin/" | |
72b7f7ea JM |
169 | #endif |
170 | ||
e5ef217c RO |
171 | /* Enable constructor priorities if the configured linker supports it. */ |
172 | #undef SUPPORTS_INIT_PRIORITY | |
173 | #define SUPPORTS_INIT_PRIORITY HAVE_INITFINI_ARRAY_SUPPORT | |
174 | ||
c969e34e RO |
175 | /* Solaris libc and libm implement multiple behaviours for various |
176 | interfaces that have changed over the years in different versions of the | |
177 | C standard. The behaviour is controlled by linking corresponding | |
178 | values-*.o objects. Each of these objects contain alternate definitions | |
179 | of one or more variables that the libraries use to select which | |
180 | conflicting behaviour they should exhibit. There are two sets of these | |
181 | objects, values-X*.o and values-xpg*.o. | |
182 | ||
183 | The values-X[ac].o objects set the variable _lib_version. The Studio C | |
184 | compilers use values-Xc.o with either -Xc or (since Studio 12.6) | |
185 | -pedantic to select strictly conformant ISO C behaviour, otherwise | |
f58d41ff RO |
186 | values-Xa.o. Since -pedantic is a diagnostic option only in GCC, we |
187 | need to specifiy the -std=c* options and -std=iso9899:199409. We | |
188 | traditionally include -ansi, which affects C and C++, and also -std=c++* | |
189 | for consistency. | |
c969e34e RO |
190 | |
191 | The values-xpg[46].o objects define either or both __xpg[46] variables, | |
192 | selecting XPG4 mode (__xpg4) and conforming C99/SUSv3 behavior (__xpg6). | |
193 | ||
194 | Since GCC 5, gcc defaults to -std=gnu11 or higher, so we link | |
195 | values-xpg6.o to get C99 semantics. Besides, most of the runtime | |
196 | libraries always require C99 semantics. | |
197 | ||
198 | Since only one instance of _lib_version and __xpg[46] takes effekt (the | |
199 | first in ld.so.1's search path), we only link the values-*.o files into | |
200 | executable programs. */ | |
7ecfa34f | 201 | #undef STARTFILE_ARCH_SPEC |
c969e34e RO |
202 | #define STARTFILE_ARCH_SPEC \ |
203 | "%{!shared:%{!symbolic: \ | |
f58d41ff | 204 | %{ansi|std=c*|std=iso9899\\:199409:values-Xc.o%s; :values-Xa.o%s} \ |
c969e34e | 205 | %{std=c90|std=gnu90:values-xpg4.o%s; :values-xpg6.o%s}}}" |
8433a25e | 206 | |
df2a1cc4 | 207 | #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) |
7345b714 L |
208 | #define STARTFILE_CRTBEGIN_SPEC "%{static:crtbegin.o%s; \ |
209 | shared|" PIE_SPEC ":crtbeginS.o%s; \ | |
210 | :crtbegin.o%s}" | |
df2a1cc4 RO |
211 | #else |
212 | #define STARTFILE_CRTBEGIN_SPEC "crtbegin.o%s" | |
213 | #endif | |
214 | ||
ad103b01 | 215 | #if ENABLE_VTABLE_VERIFY |
e5ef217c RO |
216 | #if SUPPORTS_INIT_PRIORITY |
217 | #define STARTFILE_VTV_SPEC \ | |
218 | "%{fvtable-verify=none:%s; \ | |
219 | fvtable-verify=preinit:vtv_start_preinit.o%s; \ | |
220 | fvtable-verify=std:vtv_start.o%s}" | |
e5ef217c RO |
221 | #define ENDFILE_VTV_SPEC \ |
222 | "%{fvtable-verify=none:%s; \ | |
223 | fvtable-verify=preinit:vtv_end_preinit.o%s; \ | |
224 | fvtable-verify=std:vtv_end.o%s}" | |
ad103b01 | 225 | #else /* !SUPPORTS_INIT_PRIORITY */ |
e5ef217c | 226 | #define STARTFILE_VTV_SPEC \ |
ad103b01 RO |
227 | "%{fvtable-verify=*: \ |
228 | %e-fvtable-verify=%* is not supported in this configuration}" | |
e5ef217c | 229 | #define ENDFILE_VTV_SPEC "" |
ad103b01 RO |
230 | #endif /* !SUPPORTS_INIT_PRIORITY */ |
231 | #else /* !ENABLE_VTABLE_VERIFY */ | |
232 | #define STARTFILE_VTV_SPEC "" | |
233 | #define ENDFILE_VTV_SPEC "" | |
234 | #endif /* !ENABLE_VTABLE_VERIFY */ | |
e5ef217c | 235 | |
aaabfd71 RO |
236 | /* Link -lasan early on the command line. For -static-libasan, don't link |
237 | it for -shared link, the executable should be compiled with -static-libasan | |
238 | in that case, and for executable link with --{,no-}whole-archive around | |
239 | it to force everything into the executable. */ | |
240 | ||
241 | #ifndef USE_GNU_LD | |
242 | #define LD_WHOLE_ARCHIVE_OPTION "-z allextract" | |
243 | #define LD_NO_WHOLE_ARCHIVE_OPTION "-z defaultextract" | |
244 | #else | |
245 | #define LD_WHOLE_ARCHIVE_OPTION "--whole-archive" | |
246 | #define LD_NO_WHOLE_ARCHIVE_OPTION "--no-whole-archive" | |
247 | #endif | |
248 | ||
249 | /* Allow rejecting -fsanitize=address, e.g. for specific multilibs. */ | |
250 | #ifndef ASAN_REJECT_SPEC | |
251 | #define ASAN_REJECT_SPEC "" | |
252 | #endif | |
253 | ||
254 | #define LIBASAN_EARLY_SPEC ASAN_REJECT_SPEC \ | |
255 | " %{!shared:libasan_preinit%O%s} \ | |
256 | %{static-libasan:%{!shared: -Bstatic "\ | |
257 | LD_WHOLE_ARCHIVE_OPTION " -lasan " LD_NO_WHOLE_ARCHIVE_OPTION \ | |
258 | "-Bdynamic}}%{!static-libasan:-lasan}" | |
259 | ||
260 | /* Error out on -fsanitize=thread|leak. */ | |
261 | #define LIBTSAN_EARLY_SPEC "\ | |
8d345a96 | 262 | %e-fsanitize=thread is not supported in this configuration" |
aaabfd71 | 263 | #define LIBLSAN_EARLY_SPEC "\ |
8d345a96 | 264 | %e-fsanitize=leak is not supported in this configuration" |
aaabfd71 | 265 | |
8433a25e RO |
266 | /* We don't use the standard svr4 STARTFILE_SPEC because it's wrong for us. */ |
267 | #undef STARTFILE_SPEC | |
2d110442 | 268 | #ifdef HAVE_SOLARIS_CRTS |
f021f1d3 RO |
269 | /* Since Solaris 11.4, the OS delivers crt1.o, crti.o, and crtn.o, with a hook |
270 | for compiler-dependent stuff like profile handling. */ | |
2d110442 RO |
271 | #define STARTFILE_SPEC "%{!shared:%{!symbolic: \ |
272 | crt1.o%s \ | |
273 | %{p:%e-p is not supported; \ | |
274 | pg:crtpg.o%s gmon.o%s; \ | |
275 | :crtp.o%s}}} \ | |
e5ef217c RO |
276 | crti.o%s %(startfile_arch) %(startfile_crtbegin) \ |
277 | %(startfile_vtv)" | |
2d110442 RO |
278 | #else |
279 | #define STARTFILE_SPEC "%{!shared:%{!symbolic: \ | |
280 | %{p:mcrt1.o%s; \ | |
281 | pg:gcrt1.o%s gmon.o%s; \ | |
282 | :crt1.o%s}}} \ | |
e5ef217c RO |
283 | crti.o%s %(startfile_arch) %(startfile_crtbegin) \ |
284 | %(startfile_vtv)" | |
df2a1cc4 RO |
285 | #endif |
286 | ||
287 | #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) | |
7345b714 L |
288 | #define ENDFILE_CRTEND_SPEC "%{static:crtend.o%s; \ |
289 | shared|" PIE_SPEC ":crtendS.o%s; \ | |
290 | :crtend.o%s}" | |
df2a1cc4 RO |
291 | #else |
292 | #define ENDFILE_CRTEND_SPEC "crtend.o%s" | |
2d110442 | 293 | #endif |
8433a25e | 294 | |
7ecfa34f RO |
295 | #undef ENDFILE_SPEC |
296 | #define ENDFILE_SPEC \ | |
6347bbec | 297 | "%{Ofast|ffast-math|funsafe-math-optimizations:%{!shared:crtfastmath.o%s}} \ |
e5ef217c | 298 | %(endfile_arch) %(endfile_vtv) %(endfile_crtend) crtn.o%s" |
8433a25e | 299 | |
61aaea23 MM |
300 | #undef LINK_ARCH32_SPEC_BASE |
301 | #define LINK_ARCH32_SPEC_BASE \ | |
8433a25e RO |
302 | "%{G:-G} \ |
303 | %{YP,*} \ | |
304 | %{R*} \ | |
2cf03b11 RO |
305 | %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp%R/lib:%R/usr/lib} \ |
306 | %{!p:%{!pg:-Y P,%R/lib:%R/usr/lib}}}" | |
8433a25e | 307 | |
61aaea23 MM |
308 | #undef LINK_ARCH32_SPEC |
309 | #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE | |
310 | ||
2cf03b11 RO |
311 | /* This should be the same as LINK_ARCH32_SPEC_BASE, except with |
312 | ARCH64_SUBDIR appended to the paths. */ | |
313 | #undef LINK_ARCH64_SPEC_BASE | |
314 | #define LINK_ARCH64_SPEC_BASE \ | |
315 | "%{G:-G} \ | |
316 | %{YP,*} \ | |
317 | %{R*} \ | |
318 | %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "} \ | |
319 | %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}}}" | |
320 | ||
321 | #undef LINK_ARCH64_SPEC | |
322 | #ifndef USE_GLD | |
323 | /* FIXME: Used to be SPARC-only. Not SPARC-specfic but for the model name! */ | |
324 | #define LINK_ARCH64_SPEC \ | |
325 | "%{mcmodel=medlow:-M /usr/lib/ld/" ARCH64_SUBDIR "/map.below4G} " \ | |
326 | LINK_ARCH64_SPEC_BASE | |
327 | #else | |
328 | #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE | |
329 | #endif | |
330 | ||
331 | #ifdef USE_GLD | |
332 | #if DEFAULT_ARCH32_P | |
333 | #define ARCH_DEFAULT_EMULATION ARCH32_EMULATION | |
334 | #else | |
335 | #define ARCH_DEFAULT_EMULATION ARCH64_EMULATION | |
336 | #endif | |
337 | #define TARGET_LD_EMULATION "%{m32:-m " ARCH32_EMULATION "}" \ | |
338 | "%{m64:-m " ARCH64_EMULATION "}" \ | |
339 | "%{!m32:%{!m64:-m " ARCH_DEFAULT_EMULATION "}} " | |
340 | #else | |
341 | #define TARGET_LD_EMULATION "" | |
342 | #endif | |
343 | ||
8433a25e | 344 | #undef LINK_ARCH_SPEC |
2cf03b11 RO |
345 | #if DISABLE_MULTILIB |
346 | #if DEFAULT_ARCH32_P | |
347 | #define LINK_ARCH_SPEC TARGET_LD_EMULATION " \ | |
348 | %{m32:%(link_arch32)} \ | |
349 | %{m64:%edoes not support multilib} \ | |
350 | %{!m32:%{!m64:%(link_arch_default)}} \ | |
351 | " | |
352 | #else | |
353 | #define LINK_ARCH_SPEC TARGET_LD_EMULATION " \ | |
354 | %{m32:%edoes not support multilib} \ | |
355 | %{m64:%(link_arch64)} \ | |
356 | %{!m32:%{!m64:%(link_arch_default)}} \ | |
357 | " | |
358 | #endif | |
359 | #else | |
360 | #define LINK_ARCH_SPEC TARGET_LD_EMULATION " \ | |
361 | %{m32:%(link_arch32)} \ | |
362 | %{m64:%(link_arch64)} \ | |
363 | %{!m32:%{!m64:%(link_arch_default)}}" | |
364 | #endif | |
365 | ||
366 | #define LINK_ARCH_DEFAULT_SPEC \ | |
367 | (DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC) | |
368 | ||
369 | #undef SUBTARGET_EXTRA_SPECS | |
370 | #define SUBTARGET_EXTRA_SPECS \ | |
df2a1cc4 RO |
371 | { "startfile_arch", STARTFILE_ARCH_SPEC }, \ |
372 | { "startfile_crtbegin", STARTFILE_CRTBEGIN_SPEC }, \ | |
e5ef217c | 373 | { "startfile_vtv", STARTFILE_VTV_SPEC }, \ |
df2a1cc4 RO |
374 | { "link_arch32", LINK_ARCH32_SPEC }, \ |
375 | { "link_arch64", LINK_ARCH64_SPEC }, \ | |
376 | { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ | |
377 | { "link_arch", LINK_ARCH_SPEC }, \ | |
378 | { "endfile_arch", ENDFILE_ARCH_SPEC }, \ | |
e5ef217c RO |
379 | { "endfile_crtend", ENDFILE_CRTEND_SPEC }, \ |
380 | { "endfile_vtv", ENDFILE_VTV_SPEC }, \ | |
2cf03b11 | 381 | SUBTARGET_CPU_EXTRA_SPECS |
8433a25e | 382 | |
7ecfa34f RO |
383 | #ifndef USE_GLD |
384 | /* With Sun ld, -rdynamic is a no-op. */ | |
385 | #define RDYNAMIC_SPEC "" | |
386 | #else | |
387 | /* GNU ld needs --export-dynamic to implement -rdynamic. */ | |
388 | #define RDYNAMIC_SPEC "--export-dynamic" | |
389 | #endif | |
390 | ||
8dc877eb RO |
391 | #ifndef USE_GLD |
392 | /* Prefer native form with Solaris ld. */ | |
393 | #define SYSROOT_SPEC "-z sysroot=%R" | |
394 | #endif | |
395 | ||
c0fff1d0 | 396 | #if !defined(USE_GLD) && defined(ENABLE_SHARED_LIBGCC) |
91da0481 RO |
397 | /* With Sun ld, use mapfile to enforce direct binding to libgcc_s unwinder. */ |
398 | #define LINK_LIBGCC_MAPFILE_SPEC \ | |
399 | "%{shared|shared-libgcc:-M %slibgcc-unwind.map}" | |
400 | #else | |
401 | /* GNU ld doesn't support direct binding. */ | |
402 | #define LINK_LIBGCC_MAPFILE_SPEC "" | |
403 | #endif | |
404 | ||
3c698bf0 RO |
405 | /* Clear hardware capabilities, either explicitly or with OpenMP: |
406 | #pragma openmp declare simd creates clones for SSE2, AVX, and AVX2. */ | |
407 | #ifdef HAVE_LD_CLEARCAP | |
408 | #define LINK_CLEARCAP_SPEC " %{mclear-hwcap|fopenmp*:-M %sclearcap.map}" | |
409 | #else | |
410 | #define LINK_CLEARCAP_SPEC "" | |
411 | #endif | |
412 | ||
8433a25e RO |
413 | #undef LINK_SPEC |
414 | #define LINK_SPEC \ | |
415 | "%{h*} %{v:-V} \ | |
fcf52686 | 416 | %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \ |
8433a25e | 417 | %{static:-dn -Bstatic} \ |
3c698bf0 RO |
418 | %{shared:-G -dy %{!mimpure-text:-z text}} " \ |
419 | LINK_LIBGCC_MAPFILE_SPEC LINK_CLEARCAP_SPEC " \ | |
8433a25e RO |
420 | %{symbolic:-Bsymbolic -G -dy -z text} \ |
421 | %(link_arch) \ | |
422 | %{Qy:} %{!Qn:-Qy}" | |
423 | ||
e927b6ad RO |
424 | /* Use --as-needed/-z ignore -lgcc_s for eh support. */ |
425 | #ifdef HAVE_LD_AS_NEEDED | |
426 | #define USE_LD_AS_NEEDED 1 | |
427 | #endif | |
428 | ||
7ecfa34f RO |
429 | #ifdef USE_GLD |
430 | /* Solaris 11 build 135+ implements dl_iterate_phdr. GNU ld needs | |
431 | --eh-frame-hdr to create the required .eh_frame_hdr sections. */ | |
432 | #if defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR) | |
8c6562e1 | 433 | #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " |
7ecfa34f RO |
434 | #endif /* HAVE_LD_EH_FRAME && TARGET_DL_ITERATE_PHDR */ |
435 | #endif | |
6e70657a | 436 | |
df2a1cc4 RO |
437 | #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) |
438 | #ifdef USE_GLD | |
439 | /* Assert -z text by default to match Solaris ld. */ | |
440 | #define LD_PIE_SPEC "-pie %{!mimpure-text:-z text}" | |
441 | #else | |
442 | /* Solaris ld needs -z type=pie instead of -pie. */ | |
443 | #define LD_PIE_SPEC "-z type=pie %{mimpure-text:-z textoff}" | |
444 | #endif | |
445 | #else | |
446 | /* Error out if some part of PIE support is missing. */ | |
447 | #define LINK_PIE_SPEC \ | |
448 | "%{no-pie:} %{pie:%e-pie is not supported in this configuration} " | |
449 | #endif | |
450 | ||
e53b6e56 | 451 | /* collect2.cc can only parse GNU nm -n output. Solaris nm needs -png to |
3e794bfe RO |
452 | produce the same format. */ |
453 | #define NM_FLAGS "-png" | |
7ecfa34f | 454 | \f |
8433a25e | 455 | #define STDC_0_IN_SYSTEM_HEADERS 1 |
a2bec818 | 456 | |
07a43492 | 457 | /* Support Solaris-specific format checking for cmn_err. */ |
a2bec818 DJ |
458 | #define TARGET_N_FORMAT_TYPES 1 |
459 | #define TARGET_FORMAT_TYPES solaris_format_types | |
07a43492 DJ |
460 | |
461 | /* #pragma init and #pragma fini are implemented on top of init and | |
462 | fini attributes. */ | |
463 | #define SOLARIS_ATTRIBUTE_TABLE \ | |
4849deb1 JJ |
464 | { "init", 0, 0, true, false, false, false, NULL, NULL }, \ |
465 | { "fini", 0, 0, true, false, false, false, NULL, NULL } | |
07a43492 | 466 | |
7ecfa34f | 467 | /* Solaris-specific #pragmas are implemented on top of attributes. Hook in |
e53b6e56 | 468 | the bits from config/sol2.cc. */ |
7ecfa34f RO |
469 | #define SUBTARGET_INSERT_ATTRIBUTES solaris_insert_attributes |
470 | #define SUBTARGET_ATTRIBUTE_TABLE SOLARIS_ATTRIBUTE_TABLE | |
471 | ||
472 | /* Allow macro expansion in #pragma pack. */ | |
473 | #define HANDLE_PRAGMA_PACK_WITH_EXPANSION | |
474 | ||
5b880ea6 RO |
475 | #define TARGET_CXX_DECL_MANGLING_CONTEXT solaris_cxx_decl_mangling_context |
476 | ||
2ca48caa | 477 | /* Solaris/x86 as and gas support unquoted section names. */ |
2cf03b11 | 478 | #ifndef SECTION_NAME_FORMAT |
2ca48caa | 479 | #define SECTION_NAME_FORMAT "%s" |
2cf03b11 | 480 | #endif |
a0c21029 | 481 | |
07a43492 DJ |
482 | /* This is how to declare the size of a function. For Solaris, we output |
483 | any .init or .fini entries here. */ | |
484 | #undef ASM_DECLARE_FUNCTION_SIZE | |
485 | #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ | |
486 | do \ | |
487 | { \ | |
488 | if (!flag_inhibit_size_directive) \ | |
489 | ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ | |
490 | solaris_output_init_fini (FILE, DECL); \ | |
491 | } \ | |
492 | while (0) | |
493 | ||
f0c01ffd RO |
494 | #ifndef USE_GAS |
495 | #undef TARGET_ASM_ASSEMBLE_VISIBILITY | |
496 | #define TARGET_ASM_ASSEMBLE_VISIBILITY solaris_assemble_visibility | |
b8f9bca0 JM |
497 | |
498 | #define AS_NEEDS_DASH_FOR_PIPED_INPUT | |
499 | ||
f0c01ffd | 500 | #endif |
7ecfa34f RO |
501 | /* Solaris has an implementation of __enable_execute_stack. */ |
502 | #define HAVE_ENABLE_EXECUTE_STACK | |
503 | ||
504 | /* Static stack checking is supported by means of probes. */ | |
505 | #define STACK_CHECK_STATIC_BUILTIN 1 | |
9c0c4ec7 JM |
506 | |
507 | #define TARGET_POSIX_IO | |
7ecfa34f | 508 | |
2cf03b11 RO |
509 | /* Solaris 10 has the float and long double forms of math functions. |
510 | We redefine this hook so the version from elfos.h header won't be used. */ | |
d33d9e47 | 511 | #undef TARGET_LIBC_HAS_FUNCTION |
2cf03b11 | 512 | #define TARGET_LIBC_HAS_FUNCTION default_libc_has_function |
d33d9e47 | 513 | |
7ecfa34f RO |
514 | extern GTY(()) tree solaris_pending_aligns; |
515 | extern GTY(()) tree solaris_pending_inits; | |
516 | extern GTY(()) tree solaris_pending_finis; |