This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[patch] Fix test suite failures with --as-needed
- From: Allan McRae <allan at archlinux dot org>
- To: libc-alpha at sourceware dot org
- Date: Mon, 16 Apr 2012 19:39:39 +1000
- Subject: [patch] Fix test suite failures with --as-needed
Running the testsuite with -Wl,--as-needed in LDFLAGS introduces the
following test failures:
make[2]: *** [/build/src/glibc-build/stdlib/tst-putenv.out] Error 1
make[2]: *** [/build/src/glibc-build/nptl/tst-cancel24] Error 1
make[2]: *** [/build/src/glibc-build/nptl/tst-tls6.out] Error 1
make[2]: *** [/build/src/glibc-build/elf/nodelete2.out] Error 1
make[2]: *** [/build/src/glibc-build/elf/next.out] Error 1
make[2]: *** [/build/src/glibc-build/elf/reldep5.out] Error 127
make[2]: *** [/build/src/glibc-build/elf/reldep8.out] Error 134
make[2]: *** [/build/src/glibc-build/elf/noload.out] Error 1
make[2]: *** [/build/src/glibc-build/elf/unload4.out] Error 127
make[2]: *** [/build/src/glibc-build/elf/order2.out] Error 1
make[2]: *** [/build/src/glibc-build/elf/reldep6.out] Error 1
make[2]: *** [/build/src/glibc-build/elf/tst-initorder2.out] Error 1
make[2]: *** [/build/src/glibc-build/elf/tst-initorder.out] Error 1
Add $(no-as-needed) to LDFLAGS where required to fix this.
Tested i686 and x86_64 linux.
2012-04-16 Allan McRae <allan@archlinux.org>
* elf/Makefile: Fix linking tests with --as-needed
* nptl/Makefile: Likewise
* stdlib/Makefile: Likewise
diff --git a/elf/Makefile b/elf/Makefile
index 59a3936..ea94f62 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -497,6 +497,18 @@ $(objpfx)tst-initordera3.so:
$(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb
$(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
$(objpfx)tst-initorder: $(objpfx)tst-initordera4.so
$(objpfx)tst-initordera1.so $(objpfx)tst-initorderb2.so
+LDFLAGS-nodel2mod3.so = $(no-as-needed)
+LDFLAGS-reldepmod5.so = $(no-as-needed)
+LDFLAGS-reldep6mod1.so = $(no-as-needed)
+LDFLAGS-reldep6mod4.so = $(no-as-needed)
+LDFLAGS-reldep8mod3.so = $(no-as-needed)
+LDFLAGS-unload4mod1.so = $(no-as-needed)
+LDFLAGS-unload4mod2.so = $(no-as-needed)
+LDFLAGS-tst-initorder = $(no-as-needed)
+LDFLAGS-tst-initordera2.so = $(no-as-needed)
+LDFLAGS-tst-initordera3.so = $(no-as-needed)
+LDFLAGS-tst-initordera4.so = $(no-as-needed)
+LDFLAGS-tst-initorderb2.so = $(no-as-needed)
LDFLAGS-tst-tlsmod5.so = -nostdlib
LDFLAGS-tst-tlsmod6.so = -nostdlib
@@ -630,7 +642,7 @@ $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so)
vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so)
$(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
-LDFLAGS-noload = -rdynamic
+LDFLAGS-noload = -rdynamic $(no-as-needed)
$(objpfx)noload.out: $(objpfx)testobj5.so
$(objpfx)noload-mem: $(objpfx)noload.out
@@ -675,6 +687,7 @@ $(objpfx)reldep4: $(libdl)
$(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so
$(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
+LDFLAGS-next = $(no-as-needed)
$(objpfx)unload2: $(libdl)
$(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so
@@ -999,6 +1012,8 @@ $(objpfx)order2mod1.so: $(objpfx)order2mod4.so
$(objpfx)order2mod4.so: $(objpfx)order2mod3.so
$(objpfx)order2mod2.so: $(objpfx)order2mod3.so
order2mod2.so-no-z-defs = yes
+LDFLAGS-order2mod1.so = $(no-as-needed)
+LDFLAGS-order2mod2.so = $(no-as-needed)
tst-stackguard1-ARGS = --command "$(built-program-cmd) --child"
tst-stackguard1-static-ARGS = --command
"$(objpfx)tst-stackguard1-static --child"
@@ -1087,6 +1102,10 @@ $(objpfx)tst-initorder2:
$(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so
$(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so
$(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so
$(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so
+LDFLAGS-tst-initorder2 = $(no-as-needed)
+LDFLAGS-tst-initorder2a.so = $(no-as-needed)
+LDFLAGS-tst-initorder2b.so = $(no-as-needed)
+LDFLAGS-tst-initorder2c.so = $(no-as-needed)
define o-iterator-doit
$(objpfx)tst-initorder2$o.os: tst-initorder2.c; \
$$(compile-command.c) -DNAME=\"$o\"
diff --git a/nptl/Makefile b/nptl/Makefile
index 52277dd..be7a05c 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -456,6 +456,7 @@ $(objpfx)tst-tls4: $(libdl) $(shared-thread-library)
$(objpfx)tst-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so
$(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library)
+LDFLAGS-tst-tls5 = $(no-as-needed)
LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so
ifeq ($(build-shared),yes)
@@ -499,7 +500,7 @@ $(objpfx)tst-clock2: $(common-objpfx)rt/librt.a
$(objpfx)tst-rwlock14: $(common-objpfx)rt/librt.a
endif
-LDFLAGS-tst-cancel24 = -lstdc++
+LDFLAGS-tst-cancel24 = $(no-as-needed) -lstdc++
extra-B-pthread.so = -B$(common-objpfx)nptl/
$(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 44eb20d..f7811c5 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -138,6 +138,7 @@ $(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh
$(objpfx)tst-fmtmsg
$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)'
$(common-objpfx)stdlib/
$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
+LDFLAGS-tst-putenv = $(no-as-needed)
$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os
$(build-module)