2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / config / gnu-user.h
blobcba3c0b92e3206e3cd3ed62b0ac46c4899d67cd6
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 /* Don't assume anything about the header files. */
30 #define NO_IMPLICIT_EXTERN_C
32 #undef ASM_APP_ON
33 #define ASM_APP_ON "#APP\n"
35 #undef ASM_APP_OFF
36 #define ASM_APP_OFF "#NO_APP\n"
38 #if ENABLE_OFFLOADING == 1
39 #define CRTOFFLOADBEGIN "%{fopenacc|fopenmp:crtoffloadbegin%O%s}"
40 #define CRTOFFLOADEND "%{fopenacc|fopenmp:crtoffloadend%O%s}"
41 #else
42 #define CRTOFFLOADBEGIN ""
43 #define CRTOFFLOADEND ""
44 #endif
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'. */
51 #if defined HAVE_LD_PIE
52 #define GNU_USER_TARGET_STARTFILE_SPEC \
53 "%{shared:; \
54 pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \
55 static:crt1.o%s; \
56 static-pie:rcrt1.o%s; \
57 " PIE_SPEC ":Scrt1.o%s; \
58 :crt1.o%s} \
59 crti.o%s \
60 %{static:crtbeginT.o%s; \
61 shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \
62 :crtbegin.o%s} \
63 %{fvtable-verify=none:%s; \
64 fvtable-verify=preinit:vtv_start_preinit.o%s; \
65 fvtable-verify=std:vtv_start.o%s} \
66 " CRTOFFLOADBEGIN
67 #else
68 #define GNU_USER_TARGET_STARTFILE_SPEC \
69 "%{shared:; \
70 pg|p|profile:gcrt1.o%s; \
71 :crt1.o%s} \
72 crti.o%s \
73 %{static:crtbeginT.o%s; \
74 shared|pie|static-pie:crtbeginS.o%s; \
75 :crtbegin.o%s} \
76 %{fvtable-verify=none:%s; \
77 fvtable-verify=preinit:vtv_start_preinit.o%s; \
78 fvtable-verify=std:vtv_start.o%s} \
79 " CRTOFFLOADBEGIN
80 #endif
81 #undef STARTFILE_SPEC
82 #define STARTFILE_SPEC GNU_USER_TARGET_STARTFILE_SPEC
84 /* Provide a ENDFILE_SPEC appropriate for GNU userspace. Here we tack on
85 the GNU userspace magical crtend.o file (see crtstuff.c) which
86 provides part of the support for getting C++ file-scope static
87 object constructed before entering `main', followed by a normal
88 GNU userspace "finalizer" file, `crtn.o'. */
90 #if defined HAVE_LD_PIE
91 #define GNU_USER_TARGET_ENDFILE_SPEC \
92 "%{fvtable-verify=none:%s; \
93 fvtable-verify=preinit:vtv_end_preinit.o%s; \
94 fvtable-verify=std:vtv_end.o%s} \
95 %{static:crtend.o%s; \
96 shared|static-pie|" PIE_SPEC ":crtendS.o%s; \
97 :crtend.o%s} \
98 crtn.o%s \
99 " CRTOFFLOADEND
100 #else
101 #define GNU_USER_TARGET_ENDFILE_SPEC \
102 "%{fvtable-verify=none:%s; \
103 fvtable-verify=preinit:vtv_end_preinit.o%s; \
104 fvtable-verify=std:vtv_end.o%s} \
105 %{static:crtend.o%s; \
106 shared|pie|static-pie:crtendS.o%s; \
107 :crtend.o%s} \
108 crtn.o%s \
109 " CRTOFFLOADEND
110 #endif
111 #undef ENDFILE_SPEC
112 #define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC
114 /* This is for -profile to use -lc_p instead of -lc. */
115 #define GNU_USER_TARGET_CC1_SPEC "%{profile:-p}"
116 #ifndef CC1_SPEC
117 #define CC1_SPEC GNU_USER_TARGET_CC1_SPEC
118 #endif
120 /* The GNU C++ standard library requires that these macros be defined. */
121 #undef CPLUSPLUS_CPP_SPEC
122 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
124 #define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \
125 "%{shared:-lc} \
126 %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
128 #define GNU_USER_TARGET_LIB_SPEC \
129 "%{pthread:-lpthread} " \
130 GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC
132 #undef LIB_SPEC
133 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
135 #if defined(HAVE_LD_EH_FRAME_HDR)
136 #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} "
137 #endif
139 #undef LINK_GCC_C_SEQUENCE_SPEC
140 #define LINK_GCC_C_SEQUENCE_SPEC \
141 "%{static|static-pie:--start-group} %G %L \
142 %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}"
144 /* Use --as-needed -lgcc_s for eh support. */
145 #ifdef HAVE_LD_AS_NEEDED
146 #define USE_LD_AS_NEEDED 1
147 #endif
149 #define TARGET_POSIX_IO
151 #undef TARGET_LIBC_HAS_FUNCTION
152 #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
154 /* Link -lasan early on the command line. For -static-libasan, don't link
155 it for -shared link, the executable should be compiled with -static-libasan
156 in that case, and for executable link with --{,no-}whole-archive around
157 it to force everything into the executable. And similarly for -ltsan
158 and -llsan. */
159 #if defined(HAVE_LD_STATIC_DYNAMIC)
160 #undef LIBASAN_EARLY_SPEC
161 #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
162 "%{static-libasan:%{!shared:" \
163 LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
164 LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
165 #undef LIBTSAN_EARLY_SPEC
166 #define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \
167 "%{static-libtsan:%{!shared:" \
168 LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
169 LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
170 #undef LIBLSAN_EARLY_SPEC
171 #define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \
172 "%{static-liblsan:%{!shared:" \
173 LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
174 LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
175 #endif