Add <bit> and <version> to freestanding headers
[official-gcc.git] / gcc / config / gnu-user.h
blob5b48fb215149957b3e3eb232271964f4552b13c2
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.
4 Copyright (C) 1995-2018 Free Software Foundation, Inc.
5 Contributed by Eric Youngdale.
6 Modified for stabs-in-ELF by H.J. Lu (hjl@lucon.org).
8 This file is part of GCC.
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.
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.
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.
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/>. */
29 #undef ASM_APP_ON
30 #define ASM_APP_ON "#APP\n"
32 #undef ASM_APP_OFF
33 #define ASM_APP_OFF "#NO_APP\n"
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
43 /* Provide a STARTFILE_SPEC appropriate for GNU userspace. Here we add
44 the GNU userspace magical crtbegin.o file (see crtstuff.c) which
45 provides part of the support for getting C++ file-scope static
46 object constructed before entering `main'. */
48 #if defined HAVE_LD_PIE
49 #define GNU_USER_TARGET_STARTFILE_SPEC \
50 "%{shared:; \
51 pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
52 static:crt1.o%s; \
53 static-pie:rcrt1.o%s; \
54 " PIE_SPEC ":Scrt1.o%s; \
55 :crt1.o%s} \
56 crti.o%s \
57 %{static:crtbeginT.o%s; \
58 shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
59 :crtbegin.o%s} \
60 %{fvtable-verify=none:%s; \
61 fvtable-verify=preinit:vtv_start_preinit.o%s; \
62 fvtable-verify=std:vtv_start.o%s} \
63 " CRTOFFLOADBEGIN
64 #else
65 #define GNU_USER_TARGET_STARTFILE_SPEC \
66 "%{shared:; \
67 pg|p|profile:gcrt1.o%s; \
68 :crt1.o%s} \
69 crti.o%s \
70 %{static:crtbeginT.o%s; \
71 shared|pie|static-pie:crtbeginS.o%s; \
72 :crtbegin.o%s} \
73 %{fvtable-verify=none:%s; \
74 fvtable-verify=preinit:vtv_start_preinit.o%s; \
75 fvtable-verify=std:vtv_start.o%s} \
76 " CRTOFFLOADBEGIN
77 #endif
78 #undef STARTFILE_SPEC
79 #define STARTFILE_SPEC GNU_USER_TARGET_STARTFILE_SPEC
81 /* Provide a ENDFILE_SPEC appropriate for GNU userspace. Here we tack on
82 the GNU userspace magical crtend.o file (see crtstuff.c) which
83 provides part of the support for getting C++ file-scope static
84 object constructed before entering `main', followed by a normal
85 GNU userspace "finalizer" file, `crtn.o'. */
87 #if defined HAVE_LD_PIE
88 #define GNU_USER_TARGET_ENDFILE_SPEC \
89 "%{fvtable-verify=none:%s; \
90 fvtable-verify=preinit:vtv_end_preinit.o%s; \
91 fvtable-verify=std:vtv_end.o%s} \
92 %{static:crtend.o%s; \
93 shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
94 :crtend.o%s} \
95 crtn.o%s \
96 " CRTOFFLOADEND
97 #else
98 #define GNU_USER_TARGET_ENDFILE_SPEC \
99 "%{fvtable-verify=none:%s; \
100 fvtable-verify=preinit:vtv_end_preinit.o%s; \
101 fvtable-verify=std:vtv_end.o%s} \
102 %{static:crtend.o%s; \
103 shared|pie|static-pie:crtendS.o%s; \
104 :crtend.o%s} \
105 crtn.o%s \
106 " CRTOFFLOADEND
107 #endif
108 #undef ENDFILE_SPEC
109 #define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC
111 /* This is for -profile to use -lc_p instead of -lc. */
112 #define GNU_USER_TARGET_CC1_SPEC "%{profile:-p}"
113 #ifndef CC1_SPEC
114 #define CC1_SPEC GNU_USER_TARGET_CC1_SPEC
115 #endif
117 /* The GNU C++ standard library requires that these macros be defined. */
118 #undef CPLUSPLUS_CPP_SPEC
119 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
121 #define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \
122 "%{shared:-lc} \
123 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
125 #define GNU_USER_TARGET_LIB_SPEC \
126 "%{pthread:-lpthread} " \
127 GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC
129 #undef LIB_SPEC
130 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
132 #if defined(HAVE_LD_EH_FRAME_HDR)
133 #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
134 #endif
136 #undef LINK_GCC_C_SEQUENCE_SPEC
137 #define LINK_GCC_C_SEQUENCE_SPEC \
138 "%{static|static-pie:--start-group} %G %{!nolibc:%L} \
139 %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
141 /* Use --as-needed -lgcc_s for eh support. */
142 #ifdef HAVE_LD_AS_NEEDED
143 #define USE_LD_AS_NEEDED 1
144 #endif
146 #define TARGET_POSIX_IO
148 #undef TARGET_LIBC_HAS_FUNCTION
149 #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
151 /* Link -lasan early on the command line. For -static-libasan, don't link
152 it for -shared link, the executable should be compiled with -static-libasan
153 in that case, and for executable link with --{,no-}whole-archive around
154 it to force everything into the executable. And similarly for -ltsan
155 and -llsan. */
156 #if defined(HAVE_LD_STATIC_DYNAMIC)
157 #undef LIBASAN_EARLY_SPEC
158 #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
159 "%{static-libasan:%{!shared:" \
160 LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
161 LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
162 #undef LIBTSAN_EARLY_SPEC
163 #define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \
164 "%{static-libtsan:%{!shared:" \
165 LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
166 LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
167 #undef LIBLSAN_EARLY_SPEC
168 #define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \
169 "%{static-liblsan:%{!shared:" \
170 LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
171 LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
172 #endif