* Makerules (no-whole-archive): New variable.
(build-shlib): Use it.
* elf/Makefile (libdl.so): Use it.
* configure.in (libc_cv_ld_no_whole_archive): New check for
--no-whole-archive.
* config.make.in (have-no-whole-archive): New variable.
# on other shared objects.
lib%.so: lib%_pic.a; $(build-shlib)
# 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) \
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.
endef
# Don't try to use -lc when making libc.so itself.
elf = @elf@
have-initfini = @libc_cv_have_initfini@
elf = @elf@
have-initfini = @libc_cv_have_initfini@
+have-no-whole-archive = @libc_cv_ld_no_whole_archive@
+
# Configuration options.
gnu-as = @gnu_as@
gnu-ld = @gnu_ld@
# Configuration options.
gnu-as = @gnu_as@
gnu-ld = @gnu_ld@
AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
fi
AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
fi
+AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
+cat > conftest.c <<\EOF
+main () { exit (0); }
+EOF
+if ${CC-cc} $CFLAGS -Wl,--no-whole-archive \
+ -o conftest conftest.c 2>/dev/null; then
+ libc_cv_ld_no_whole_archive=yes
+else
+ libc_cv_ld_no_whole_archive=no
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_ld_no_whole_archive)dnl
+
### End of automated tests.
### Now run sysdeps configure fragments.
### End of automated tests.
### Now run sysdeps configure fragments.
# Makefile for elf subdirectory of GNU C Library.
# Makefile for elf subdirectory of GNU C Library.
-# Copyright (C) 1995 Free Software Foundation, Inc.
+# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
$(patsubst %/,cd %;,$(objpfx)) \
$(LINK.o) -shared -o $(@:$(objpfx)%=%) \
$(LDFLAGS.so) $(LDFLAGS-dl.so) \
$(patsubst %/,cd %;,$(objpfx)) \
$(LINK.o) -shared -o $(@:$(objpfx)%=%) \
$(LDFLAGS.so) $(LDFLAGS-dl.so) \
- -Wl,--whole-archive $(^:$(objpfx)%=%)
+ -Wl,--whole-archive $(^:$(objpfx)%=%) $(no-whole-archive)
$(slibdir)/$(rtld-installed-name): $(objpfx)ld.so; $(do-install-program)
$(slibdir)/ld-linux.so.1: $(objpfx)ld-linux.so.1; $(do-install-program)
$(slibdir)/$(rtld-installed-name): $(objpfx)ld.so; $(do-install-program)
$(slibdir)/ld-linux.so.1: $(objpfx)ld-linux.so.1; $(do-install-program)