From: roland Date: Sat, 20 Apr 1996 00:04:28 +0000 (+0000) Subject: Thu Apr 18 21:07:27 1996 Roland McGrath X-Git-Tag: libc-960420~6 X-Git-Url: http://git.csclub.uwaterloo.ca/?p=kopensolaris-gnu%2Fglibc.git;a=commitdiff_plain;h=f20905e7d115c6e12a59dca417bc0c8b1a44895a Thu Apr 18 21:07:27 1996 Roland McGrath * 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. --- diff --git a/Makerules b/Makerules index cb22d03945..a16337806c 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. diff --git a/config.make.in b/config.make.in index 50571745d0..593d9ca908 100644 --- a/config.make.in +++ b/config.make.in @@ -17,6 +17,8 @@ config-defines = @DEFS@ 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@ diff --git a/configure.in b/configure.in index 734c5ad324..711635cc5d 100644 --- a/configure.in +++ b/configure.in @@ -469,6 +469,19 @@ elif test $libc_cv_asm_weakext_directive = yes; then 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. diff --git a/elf/Makefile b/elf/Makefile index a77460d1de..dfb307b682 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1,6 +1,6 @@ # 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 @@ -80,7 +80,7 @@ $(objpfx)libdl.so: $(objpfx)libdl_pic.a $(common-objpfx)libc.so $(objpfx)ld.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)