[patch] Link the dummy libgcj_bc shared library with --no-as-needed

Matthias Klose <[email protected]> Wed, 04 Sep 2013 12:05:52 +0200
Newsgroups gmane.comp.gcc.java.patches
Message-ID <[email protected]>
When building a compiler which passes --no-as-needed by default to the linker,
libgcj_bc.so ends up without a DTNEEDED entry for libgcj, because no symbols in
libgcj are required to resolve symbols in libgcj_bc.  This causes about 500 test
cases to fail.  Solved by explicitly passing -Wl,--no-as-needed.  Is this ok for
upstream? It's not needed, but doesn't hurt either.

  Matthias
gcc-as-needed.diff (text/plain, 513 B)
	* Makefile.am (libgcj_bc.la): Link using -Wl,--no-as-needed.
	* Makefile.in: Regenerate.

--- a/src/libjava/Makefile.am
+++ b/src/libjava/Makefile.am
@@ -625,7 +625,7 @@
 	rm .libs/libgcj_bc.so; \
 	mv .libs/libgcj_bc.so.1.0.0 .libs/libgcj_bc.so; \
 	$(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
-	-o .libs/libgcj_bc.so.1.0.0 -lgcj || exit; \
+	-o .libs/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
 	rm .libs/libgcj_bc.so.1; \
 	$(LN_S) libgcj_bc.so.1.0.0 .libs/libgcj_bc.so.1