1
# DP: On linux targets pass --as-needed by default to the linker.
3
Index: b/src/gcc/config/aarch64/aarch64-linux.h
4
===================================================================
5
--- a/src/gcc/config/aarch64/aarch64-linux.h
6
+++ b/src/gcc/config/aarch64/aarch64-linux.h
9
#define LINUX_TARGET_LINK_SPEC "%{h*} \
14
%{symbolic:-Bsymbolic} \
15
Index: b/src/gcc/config/ia64/linux.h
16
===================================================================
17
--- a/src/gcc/config/ia64/linux.h
18
+++ b/src/gcc/config/ia64/linux.h
20
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
23
-#define LINK_SPEC " --hash-style=gnu \
24
+#define LINK_SPEC " --hash-style=gnu --as-needed \
28
Index: b/src/gcc/config/sparc/linux.h
29
===================================================================
30
--- a/src/gcc/config/sparc/linux.h
31
+++ b/src/gcc/config/sparc/linux.h
33
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
36
-#define LINK_SPEC "-m elf32_sparc --hash-style=gnu %{shared:-shared} \
37
+#define LINK_SPEC "-m elf32_sparc --hash-style=gnu --as-needed %{shared:-shared} \
38
%{!mno-relax:%{!r:-relax}} \
41
Index: b/src/gcc/config/s390/linux.h
42
===================================================================
43
--- a/src/gcc/config/s390/linux.h
44
+++ b/src/gcc/config/s390/linux.h
49
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} --hash-style=gnu \
50
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --hash-style=gnu --as-needed \
54
Index: b/src/gcc/config/rs6000/linux64.h
55
===================================================================
56
--- a/src/gcc/config/rs6000/linux64.h
57
+++ b/src/gcc/config/rs6000/linux64.h
62
-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --hash-style=gnu %{!shared: %{!static: \
63
+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --hash-style=gnu --as-needed %{!shared: %{!static: \
64
%{rdynamic:-export-dynamic} \
65
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}"
67
-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --hash-style=gnu %{!shared: %{!static: \
68
+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --hash-style=gnu --as-needed %{!shared: %{!static: \
69
%{rdynamic:-export-dynamic} \
70
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}"
72
Index: b/src/gcc/config/rs6000/sysv4.h
73
===================================================================
74
--- a/src/gcc/config/rs6000/sysv4.h
75
+++ b/src/gcc/config/rs6000/sysv4.h
77
#define GNU_USER_DYNAMIC_LINKER \
78
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
80
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --hash-style=gnu %{!shared: %{!static: \
81
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --hash-style=gnu --as-needed %{!shared: %{!static: \
82
%{rdynamic:-export-dynamic} \
83
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
85
Index: b/src/gcc/config/i386/gnu-user64.h
86
===================================================================
87
--- a/src/gcc/config/i386/gnu-user64.h
88
+++ b/src/gcc/config/i386/gnu-user64.h
90
%{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
91
%{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
97
Index: b/src/gcc/config/i386/gnu-user.h
98
===================================================================
99
--- a/src/gcc/config/i386/gnu-user.h
100
+++ b/src/gcc/config/i386/gnu-user.h
102
{ "link_emulation", GNU_USER_LINK_EMULATION },\
103
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
105
-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --hash-style=gnu %{shared:-shared} \
106
+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --hash-style=gnu --as-needed %{shared:-shared} \
109
%{rdynamic:-export-dynamic} \
110
Index: b/src/gcc/config/alpha/linux-elf.h
111
===================================================================
112
--- a/src/gcc/config/alpha/linux-elf.h
113
+++ b/src/gcc/config/alpha/linux-elf.h
116
#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
118
-#define LINK_SPEC "-m elf64alpha --hash-style=gnu %{G*} %{relax:-relax} \
119
+#define LINK_SPEC "-m elf64alpha --hash-style=gnu --as-needed %{G*} %{relax:-relax} \
120
%{O*:-O3} %{!O*:-O1} \
123
Index: b/src/gcc/config/arm/linux-elf.h
124
===================================================================
125
--- a/src/gcc/config/arm/linux-elf.h
126
+++ b/src/gcc/config/arm/linux-elf.h
128
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "} \
132
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
133
SUBTARGET_EXTRA_LINK_SPEC