1 From a6c5b9d7b48601a8a4e6bde6c4c48880caf0ec78 Mon Sep 17 00:00:00 2001
2 From: Andy Fiddaman <omnios@citrus-it.co.uk>
3 Date: Wed, 19 Feb 2020 21:30:23 +0000
4 Subject: -G should imply the same specs as -shared
7 gcc/config/sol2.h | 38 ++++++++++++++++++--------------------
8 1 file changed, 18 insertions(+), 20 deletions(-)
10 diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
11 index f4cbf3e1eb1c..dd6d25a534a7 100644
12 --- a/gcc/config/sol2.h
13 +++ b/gcc/config/sol2.h
14 @@ -200,7 +200,7 @@ along with GCC; see the file COPYING3. If not see
15 executable programs. */
16 #undef STARTFILE_ARCH_SPEC
17 #define STARTFILE_ARCH_SPEC \
18 - "%{!shared:%{!symbolic: \
19 + "%{!shared:%{!symbolic:%{!G: \
21 std=c89|std=c90|std=gnu89|std=gnu90:values-Xa.o%s; \
22 ansi|std=c*|std=iso9899\\:199409:values-Xc.o%s; \
23 @@ -208,14 +208,14 @@ along with GCC; see the file COPYING3. If not see
25 std=c89|std=c90|std=gnu89|std=gnu90:; \
30 #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS)
31 #define STARTFILE_CRTBEGIN_SPEC "%{static:crtbegin.o%s; \
32 - shared|" PIE_SPEC ":crtbeginS.o%s; \
33 + shared|G|" PIE_SPEC ":crtbeginS.o%s; \
36 -#define STARTFILE_CRTBEGIN_SPEC "%{shared:crtbeginS.o%s;:crtbegin.o%s}"
37 +#define STARTFILE_CRTBEGIN_SPEC "%{shared|G:crtbeginS.o%s;:crtbegin.o%s}"
40 #if ENABLE_VTABLE_VERIFY
41 @@ -258,10 +258,10 @@ along with GCC; see the file COPYING3. If not see
44 #define LIBASAN_EARLY_SPEC ASAN_REJECT_SPEC \
45 - " %{!shared:libasan_preinit%O%s} \
46 - %{static-libasan:%{!shared: -Bstatic "\
47 + " %{!shared:%{!G:libasan_preinit%O%s}} \
48 + %{static-libasan:%{!shared:%{!G: -Bstatic "\
49 LD_WHOLE_ARCHIVE_OPTION " -lasan " LD_NO_WHOLE_ARCHIVE_OPTION \
50 - "-Bdynamic}}%{!static-libasan:-lasan}"
51 + "-Bdynamic}}}%{!static-libasan:-lasan}"
53 /* Error out on -fsanitize=thread|leak. */
54 #define LIBTSAN_EARLY_SPEC "\
55 @@ -274,28 +274,28 @@ along with GCC; see the file COPYING3. If not see
56 #ifdef HAVE_SOLARIS_CRTS
57 /* Since Solaris 11.4, the OS delivers crt1.o, crti.o, and crtn.o, with a hook
58 for compiler-dependent stuff like profile handling. */
59 -#define STARTFILE_SPEC "%{!shared:%{!symbolic: \
60 +#define STARTFILE_SPEC "%{!shared:%{!symbolic:%{!G: \
62 %{p:%e-p is not supported; \
63 pg:crtpg.o%s gmon.o%s; \
66 crti.o%s %(startfile_arch) %(startfile_crtbegin) \
69 -#define STARTFILE_SPEC "%{!shared:%{!symbolic: \
70 +#define STARTFILE_SPEC "%{!shared:%{!symbolic:%{!G: \
72 pg:gcrt1.o%s gmon.o%s; \
75 crti.o%s %(startfile_arch) %(startfile_crtbegin) \
79 #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS)
80 #define ENDFILE_CRTEND_SPEC "%{static:crtend.o%s; \
81 - shared|" PIE_SPEC ":crtendS.o%s; \
82 + shared|G|" PIE_SPEC ":crtendS.o%s; \
85 -#define ENDFILE_CRTEND_SPEC "%{shared:crtendS.o%s;:crtend.o%s}"
86 +#define ENDFILE_CRTEND_SPEC "%{shared|G:crtendS.o%s;:crtend.o%s}"
90 @@ -305,8 +305,7 @@ along with GCC; see the file COPYING3. If not see
92 #undef LINK_ARCH32_SPEC_BASE
93 #define LINK_ARCH32_SPEC_BASE \
98 %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp%R/lib:%R/usr/lib} \
99 %{!p:%{!pg:-Y P,%R/lib:%R/usr/lib}}}"
100 @@ -318,8 +317,7 @@ along with GCC; see the file COPYING3. If not see
101 ARCH64_SUBDIR appended to the paths. */
102 #undef LINK_ARCH64_SPEC_BASE
103 #define LINK_ARCH64_SPEC_BASE \
108 %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "} \
109 %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}}}"
110 @@ -402,7 +400,7 @@ along with GCC; see the file COPYING3. If not see
111 #if !defined(USE_GLD) && defined(ENABLE_SHARED_LIBGCC)
112 /* With Sun ld, use mapfile to enforce direct binding to libgcc_s unwinder. */
113 #define LINK_LIBGCC_MAPFILE_SPEC \
114 - "%{shared|shared-libgcc:-M %slibgcc-unwind.map}"
115 + "%{shared|shared-libgcc|G:-M %slibgcc-unwind.map}"
117 /* GNU ld doesn't support direct binding. */
118 #define LINK_LIBGCC_MAPFILE_SPEC ""
119 @@ -419,9 +417,9 @@ along with GCC; see the file COPYING3. If not see
123 - %{!shared:%{!static:%{rdynamic: " RDYNAMIC_SPEC "}}} \
124 + %{!shared:%{!static:%{!G:%{rdynamic: " RDYNAMIC_SPEC "}}}} \
125 %{static:-dn -Bstatic} \
126 - %{shared:-G -dy %{!mimpure-text:-z text}} " \
127 + %{shared|G:-G -dy %{!mimpure-text:-z text}} " \
128 LINK_LIBGCC_MAPFILE_SPEC LINK_CLEARCAP_SPEC " \
129 %{symbolic:-Bsymbolic -G -dy -z text} \