2015-05-12 Thomas Quinot <quinot@adacore.com>
[official-gcc.git] / gcc / config / gnu-user.h
blob2faa2e5e85a492ea824c40d4ecb89e81bea2981d
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-2015 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 /* Provide a STARTFILE_SPEC appropriate for GNU userspace. Here we add
39 the GNU userspace magical crtbegin.o file (see crtstuff.c) which
40 provides part of the support for getting C++ file-scope static
41 object constructed before entering `main'. */
43 #if defined HAVE_LD_PIE
44 #define GNU_USER_TARGET_STARTFILE_SPEC \
45 "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
46 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
47 %{fvtable-verify=none:%s; \
48 fvtable-verify=preinit:vtv_start_preinit.o%s; \
49 fvtable-verify=std:vtv_start.o%s}"
50 #else
51 #define GNU_USER_TARGET_STARTFILE_SPEC \
52 "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
53 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
54 %{fvtable-verify=none:%s; \
55 fvtable-verify=preinit:vtv_start_preinit.o%s; \
56 fvtable-verify=std:vtv_start.o%s}"
57 #endif
58 #undef STARTFILE_SPEC
59 #define STARTFILE_SPEC GNU_USER_TARGET_STARTFILE_SPEC
61 /* Provide a ENDFILE_SPEC appropriate for GNU userspace. Here we tack on
62 the GNU userspace magical crtend.o file (see crtstuff.c) which
63 provides part of the support for getting C++ file-scope static
64 object constructed before entering `main', followed by a normal
65 GNU userspace "finalizer" file, `crtn.o'. */
67 #define GNU_USER_TARGET_ENDFILE_SPEC \
68 "%{fvtable-verify=none:%s; \
69 fvtable-verify=preinit:vtv_end_preinit.o%s; \
70 fvtable-verify=std:vtv_end.o%s} \
71 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
72 #undef ENDFILE_SPEC
73 #define ENDFILE_SPEC GNU_USER_TARGET_ENDFILE_SPEC
75 /* This is for -profile to use -lc_p instead of -lc. */
76 #define GNU_USER_TARGET_CC1_SPEC "%{profile:-p}"
77 #ifndef CC1_SPEC
78 #define CC1_SPEC GNU_USER_TARGET_CC1_SPEC
79 #endif
81 /* The GNU C++ standard library requires that these macros be defined. */
82 #undef CPLUSPLUS_CPP_SPEC
83 #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
85 #define GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC \
86 "%{shared:-lc} \
87 %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}"
89 #define GNU_USER_TARGET_LIB_SPEC \
90 "%{pthread:-lpthread} " \
91 GNU_USER_TARGET_NO_PTHREADS_LIB_SPEC
93 #undef LIB_SPEC
94 #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC
96 #if defined(HAVE_LD_EH_FRAME_HDR)
97 #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
98 #endif
100 #undef LINK_GCC_C_SEQUENCE_SPEC
101 #define LINK_GCC_C_SEQUENCE_SPEC \
102 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
104 /* Use --as-needed -lgcc_s for eh support. */
105 #ifdef HAVE_LD_AS_NEEDED
106 #define USE_LD_AS_NEEDED 1
107 #endif
109 #define TARGET_POSIX_IO
111 #undef TARGET_LIBC_HAS_FUNCTION
112 #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
114 /* Link -lasan early on the command line. For -static-libasan, don't link
115 it for -shared link, the executable should be compiled with -static-libasan
116 in that case, and for executable link link with --{,no-}whole-archive around
117 it to force everything into the executable. And similarly for -ltsan
118 and -llsan. */
119 #if defined(HAVE_LD_STATIC_DYNAMIC)
120 #undef LIBASAN_EARLY_SPEC
121 #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
122 "%{static-libasan:%{!shared:" \
123 LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
124 LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
125 #undef LIBTSAN_EARLY_SPEC
126 #define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \
127 LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
128 LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
129 #undef LIBLSAN_EARLY_SPEC
130 #define LIBLSAN_EARLY_SPEC "%{static-liblsan:%{!shared:" \
131 LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
132 LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
133 #endif