]>
Commit | Line | Data |
---|---|---|
8e38461c JM |
1 | /* Definitions for systems using, at least optionally, a GNU |
2 | (glibc-based) userspace or other userspace with libc derived from | |
3 | glibc (e.g. uClibc) or for which similar specs are appropriate. | |
7adcbafe | 4 | Copyright (C) 1995-2022 Free Software Foundation, Inc. |
8e38461c JM |
5 | Contributed by Eric Youngdale. |
6 | Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org). | |
7 | ||
8 | This file is part of GCC. | |
9 | ||
10 | GCC is free software; you can redistribute it and/or modify | |
11 | it under the terms of the GNU General Public License as published by | |
12 | the Free Software Foundation; either version 3, or (at your option) | |
13 | any later version. | |
14 | ||
15 | GCC is distributed in the hope that it will be useful, | |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | GNU General Public License for more details. | |
19 | ||
20 | Under Section 7 of GPL version 3, you are granted additional | |
21 | permissions described in the GCC Runtime Library Exception, version | |
22 | 3.1, as published by the Free Software Foundation. | |
23 | ||
24 | You should have received a copy of the GNU General Public License and | |
25 | a copy of the GCC Runtime Library Exception along with this program; | |
26 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
27 | <http://www.gnu.org/licenses/>. */ | |
28 | ||
8e38461c JM |
29 | #undef ASM_APP_ON |
30 | #define ASM_APP_ON "#APP\n" | |
31 | ||
32 | #undef ASM_APP_OFF | |
33 | #define ASM_APP_OFF "#NO_APP\n" | |
34 | ||
e6861a99 IV |
35 | #if ENABLE_OFFLOADING == 1 |
36 | #define CRTOFFLOADBEGIN "%{fopenacc|fopenmp:crtoffloadbegin%O%s}" | |
37 | #define CRTOFFLOADEND "%{fopenacc|fopenmp:crtoffloadend%O%s}" | |
38 | #else | |
39 | #define CRTOFFLOADBEGIN "" | |
40 | #define CRTOFFLOADEND "" | |
41 | #endif | |
42 | ||
9515381d AM |
43 | #define GNU_USER_TARGET_CRTI "crti.o%s" |
44 | #define GNU_USER_TARGET_CRTN "crtn.o%s" | |
45 | ||
8e38461c JM |
46 | /* Provide a STARTFILE_SPEC appropriate for GNU userspace. Here we add |
47 | the GNU userspace magical crtbegin.o file (see crtstuff.c) which | |
48 | provides part of the support for getting C++ file-scope static | |
49 | object constructed before entering `main'. */ | |
2077db1b | 50 | |
8e38461c | 51 | #define GNU_USER_TARGET_STARTFILE_SPEC \ |
7345b714 | 52 | "%{shared:; \ |
5dbc0061 | 53 | pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \ |
7345b714 | 54 | static:crt1.o%s; \ |
5dbc0061 L |
55 | static-pie:rcrt1.o%s; \ |
56 | " PIE_SPEC ":Scrt1.o%s; \ | |
9515381d AM |
57 | :crt1.o%s} " \ |
58 | GNU_USER_TARGET_CRTI " \ | |
7345b714 | 59 | %{static:crtbeginT.o%s; \ |
b4fed890 | 60 | shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \ |
7345b714 | 61 | :crtbegin.o%s} \ |
2077db1b CT |
62 | %{fvtable-verify=none:%s; \ |
63 | fvtable-verify=preinit:vtv_start_preinit.o%s; \ | |
003fc14b AM |
64 | fvtable-verify=std:vtv_start.o%s} " \ |
65 | CRTOFFLOADBEGIN | |
8e38461c JM |
66 | #undef STARTFILE_SPEC |
67 | #define STARTFILE_SPEC GNU_USER_TARGET_STARTFILE_SPEC | |
68 | ||
69 | /* Provide a ENDFILE_SPEC appropriate for GNU userspace. Here we tack on | |
70 | the GNU userspace magical crtend.o file (see crtstuff.c) which | |
71 | provides part of the support for getting C++ file-scope static | |
72 | object constructed before entering `main', followed by a normal | |
73 | GNU userspace "finalizer" file, `crtn.o'. */ | |
74 | ||
9b552079 | 75 | #define GNU_USER_TARGET_ENDFILE_SPEC \ |
65a3896a | 76 | "%{!static:%{fvtable-verify=none:%s; \ |
9b552079 | 77 | fvtable-verify=preinit:vtv_end_preinit.o%s; \ |
65a3896a | 78 | fvtable-verify=std:vtv_end.o%s}} \ |
7345b714 | 79 | %{static:crtend.o%s; \ |
b4fed890 | 80 | shared|static-pie|" PIE_SPEC ":crtendS.o%s; \ |
9515381d AM |
81 | :crtend.o%s} " \ |
82 | GNU_USER_TARGET_CRTN " " \ | |
003fc14b | 83 | CRTOFFLOADEND |
8e38461c JM |
84 | #undef ENDFILE_SPEC |
85 | #define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC | |
86 | ||
87 | /* This is for -profile to use -lc_p instead of -lc. */ | |
88 | #define GNU_USER_TARGET_CC1_SPEC "%{profile:-p}" | |
89 | #ifndef CC1_SPEC | |
90 | #define CC1_SPEC GNU_USER_TARGET_CC1_SPEC | |
91 | #endif | |
92 | ||
93 | /* The GNU C++ standard library requires that these macros be defined. */ | |
94 | #undef CPLUSPLUS_CPP_SPEC | |
95 | #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" | |
96 | ||
8edb8dc8 PC |
97 | #define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \ |
98 | "%{shared:-lc} \ | |
42d406b9 | 99 | %{!shared:%{profile:-lc_p}%{!profile:-lc}}" |
8edb8dc8 PC |
100 | |
101 | #define GNU_USER_TARGET_LIB_SPEC \ | |
102 | "%{pthread:-lpthread} " \ | |
103 | GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC | |
104 | ||
8e38461c JM |
105 | #undef LIB_SPEC |
106 | #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC | |
107 | ||
108 | #if defined(HAVE_LD_EH_FRAME_HDR) | |
b4fed890 | 109 | #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " |
8e38461c JM |
110 | #endif |
111 | ||
9515381d | 112 | #define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \ |
f37866e8 | 113 | "%{static|static-pie:--start-group} %G %{!nolibc:%L} \ |
b4fed890 | 114 | %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}" |
8e38461c | 115 | |
9515381d AM |
116 | #undef LINK_GCC_C_SEQUENCE_SPEC |
117 | #define LINK_GCC_C_SEQUENCE_SPEC GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC | |
118 | ||
8e38461c JM |
119 | /* Use --as-needed -lgcc_s for eh support. */ |
120 | #ifdef HAVE_LD_AS_NEEDED | |
121 | #define USE_LD_AS_NEEDED 1 | |
122 | #endif | |
123 | ||
124 | #define TARGET_POSIX_IO | |
6c0170ea | 125 | |
d33d9e47 AI |
126 | #undef TARGET_LIBC_HAS_FUNCTION |
127 | #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function | |
03d670c8 | 128 | |
e60e09a0 JJ |
129 | /* Link -lasan early on the command line. For -static-libasan, don't link |
130 | it for -shared link, the executable should be compiled with -static-libasan | |
026c3cfd | 131 | in that case, and for executable link with --{,no-}whole-archive around |
3bd87832 MM |
132 | it to force everything into the executable. And similarly for -ltsan, |
133 | -lhwasan, and -llsan. */ | |
956d3b33 | 134 | #if defined(HAVE_LD_STATIC_DYNAMIC) |
e60e09a0 | 135 | #undef LIBASAN_EARLY_SPEC |
7d613735 JJ |
136 | #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ |
137 | "%{static-libasan:%{!shared:" \ | |
e60e09a0 | 138 | LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ |
bdfc619e | 139 | LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" |
3bd87832 MM |
140 | #undef LIBHWASAN_EARLY_SPEC |
141 | #define LIBHWASAN_EARLY_SPEC "%{static-libhwasan:%{!shared:" \ | |
142 | LD_STATIC_OPTION " --whole-archive -lhwasan --no-whole-archive " \ | |
143 | LD_DYNAMIC_OPTION "}}%{!static-libhwasan:-lhwasan}" | |
a74db9bd | 144 | #undef LIBTSAN_EARLY_SPEC |
9a45ffbd JJ |
145 | #define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \ |
146 | "%{static-libtsan:%{!shared:" \ | |
a74db9bd JJ |
147 | LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ |
148 | LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" | |
d30c7670 | 149 | #undef LIBLSAN_EARLY_SPEC |
9a45ffbd JJ |
150 | #define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \ |
151 | "%{static-liblsan:%{!shared:" \ | |
d30c7670 JJ |
152 | LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \ |
153 | LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}" | |
956d3b33 | 154 | #endif |
facf0354 ML |
155 | |
156 | #undef TARGET_F951_OPTIONS | |
157 | #define TARGET_F951_OPTIONS "%{!nostdinc:\ | |
99b1b1fa | 158 | %:fortran-preinclude-file(-fpre-include= math-vector-fortran.h finclude%s/)}" |