aboutsummaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules9
1 files changed, 8 insertions, 1 deletions
diff --git a/Makerules b/Makerules
index cb22d03..a163378 100644
--- a/Makerules
+++ b/Makerules
@@ -569,12 +569,19 @@ ifeq (yes,$(build-shared))
# on other shared objects.
lib%.so: lib%_pic.a; $(build-shlib)
+ifeq ($(libc_cv_ld_no_whole_archive),yes)
+no-whole-archive = -Wl,--no-whole-archive
+else
+no-whole-archive =
+endif
+
define build-shlib
$(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
$(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
-Wl,-rpath-link=$(common-objdir) \
- -Wl,--whole-archive $^ $(LDLIBS-$(@F:lib%.so=%).so)
+ -Wl,--whole-archive $^ $(no-whole-archive) \
+ $(LDLIBS-$(@F:lib%.so=%).so)
endef
# Don't try to use -lc when making libc.so itself.