]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/gnu-user.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / gnu-user.h
CommitLineData
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.
818ab71a 4 Copyright (C) 1995-2016 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
8This file is part of GCC.
9
10GCC is free software; you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation; either version 3, or (at your option)
13any later version.
14
15GCC is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20Under Section 7 of GPL version 3, you are granted additional
21permissions described in the GCC Runtime Library Exception, version
223.1, as published by the Free Software Foundation.
23
24You should have received a copy of the GNU General Public License and
25a copy of the GCC Runtime Library Exception along with this program;
26see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
27<http://www.gnu.org/licenses/>. */
28
29/* Don't assume anything about the header files. */
30#define NO_IMPLICIT_EXTERN_C
31
32#undef ASM_APP_ON
33#define ASM_APP_ON "#APP\n"
34
35#undef ASM_APP_OFF
36#define ASM_APP_OFF "#NO_APP\n"
37
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'. */
2077db1b 42
8e38461c
JM
43#if defined HAVE_LD_PIE
44#define GNU_USER_TARGET_STARTFILE_SPEC \
428b3812
L
45 "%{!shared: %{pg|p|profile:gcrt1.o%s;: \
46 %{" PIE_SPEC ":Scrt1.o%s} %{" NO_PIE_SPEC ":crt1.o%s}}} \
47 crti.o%s %{static:crtbeginT.o%s;: %{shared:crtbeginS.o%s} \
48 %{" PIE_SPEC ":crtbeginS.o%s} \
49 %{" NO_PIE_SPEC ":crtbegin.o%s}} \
2077db1b
CT
50 %{fvtable-verify=none:%s; \
51 fvtable-verify=preinit:vtv_start_preinit.o%s; \
52 fvtable-verify=std:vtv_start.o%s}"
8e38461c
JM
53#else
54#define GNU_USER_TARGET_STARTFILE_SPEC \
55 "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
2077db1b
CT
56 crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \
57 %{fvtable-verify=none:%s; \
58 fvtable-verify=preinit:vtv_start_preinit.o%s; \
59 fvtable-verify=std:vtv_start.o%s}"
8e38461c
JM
60#endif
61#undef STARTFILE_SPEC
62#define STARTFILE_SPEC GNU_USER_TARGET_STARTFILE_SPEC
63
64/* Provide a ENDFILE_SPEC appropriate for GNU userspace. Here we tack on
65 the GNU userspace magical crtend.o file (see crtstuff.c) which
66 provides part of the support for getting C++ file-scope static
67 object constructed before entering `main', followed by a normal
68 GNU userspace "finalizer" file, `crtn.o'. */
69
9b552079
L
70#if defined HAVE_LD_PIE
71#define GNU_USER_TARGET_ENDFILE_SPEC \
72 "%{fvtable-verify=none:%s; \
73 fvtable-verify=preinit:vtv_end_preinit.o%s; \
74 fvtable-verify=std:vtv_end.o%s} \
75 %{shared:crtendS.o%s;: %{" PIE_SPEC ":crtendS.o%s} \
76 %{" NO_PIE_SPEC ":crtend.o%s}} crtn.o%s"
77#else
8e38461c 78#define GNU_USER_TARGET_ENDFILE_SPEC \
2077db1b
CT
79 "%{fvtable-verify=none:%s; \
80 fvtable-verify=preinit:vtv_end_preinit.o%s; \
81 fvtable-verify=std:vtv_end.o%s} \
82 %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
9b552079 83#endif
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} \
8e38461c 99 %{!shared:%{mieee-fp:-lieee} %{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)
109#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
110#endif
111
112#undef LINK_GCC_C_SEQUENCE_SPEC
113#define LINK_GCC_C_SEQUENCE_SPEC \
114 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
115
116/* Use --as-needed -lgcc_s for eh support. */
117#ifdef HAVE_LD_AS_NEEDED
118#define USE_LD_AS_NEEDED 1
119#endif
120
121#define TARGET_POSIX_IO
6c0170ea 122
d33d9e47
AI
123#undef TARGET_LIBC_HAS_FUNCTION
124#define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
03d670c8 125
e60e09a0
JJ
126/* Link -lasan early on the command line. For -static-libasan, don't link
127 it for -shared link, the executable should be compiled with -static-libasan
026c3cfd 128 in that case, and for executable link with --{,no-}whole-archive around
d30c7670
JJ
129 it to force everything into the executable. And similarly for -ltsan
130 and -llsan. */
956d3b33 131#if defined(HAVE_LD_STATIC_DYNAMIC)
e60e09a0 132#undef LIBASAN_EARLY_SPEC
7d613735
JJ
133#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
134 "%{static-libasan:%{!shared:" \
e60e09a0
JJ
135 LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
136 LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
a74db9bd 137#undef LIBTSAN_EARLY_SPEC
6384c29b 138#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \
a74db9bd
JJ
139 LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
140 LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
d30c7670
JJ
141#undef LIBLSAN_EARLY_SPEC
142#define LIBLSAN_EARLY_SPEC "%{static-liblsan:%{!shared:" \
143 LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
144 LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
956d3b33 145#endif