[gold patch] Fix testsuite failures caused by -static-libgcc and -static-libstdc++ options
Cary Coutant
ccoutant@google.com
Sat Dec 22 01:02:00 GMT 2012
>> It turns out that -shared-libgcc doesn't *completely* erase the
>> effects of -static-libgcc.
>
> While you try to figure out what to do with gold, I would encourage
> you to file a bug about this, and about the missing -shared-libstdc++,
> at http://gcc.gnu.org/bugzilla/ .
Here's a revised patch that works takes care of the issues with
libgcc, libstdc++, and libgcc_s. It's ugly, using the same `echo|sed`
hack I complained about yesterday, but I hope we can replace it once
we have working -shared-libgcc and -shared-libstdc++ options in GCC.
Tested on x86_64 with GCC 4.6 and 4.7.
-cary
2012-12-21 Cary Coutant <ccoutant@google.com>
gold/
* testsuite/Makefile.am (CXXLINK_S): New macro.
(debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
* testsuite/Makefile.in: Regenerate.
-------------- next part --------------
2012-12-20 Cary Coutant <ccoutant@google.com>
Fix testsuite failures caused by -static-libgcc and -static-libstdc++
options.
gold/
* testsuite/Makefile.am (CXXLINK_S): New macro.
(debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
* testsuite/Makefile.in: Regenerate.
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 745e13d..74621e9 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -38,6 +38,12 @@ LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
+# Strip out -static-libgcc and -static-libstdc++ options, for tests
+# that must have these libraries linked dynamically. The -shared-libgcc
+# option does not work correctly, and there is no -shared-libstdc++ option.
+# (See GCC PR 55781 and PR 55782.)
+CXXLINK_S = `echo $(CXXLINK1) | sed -e 's/-static-lib\\(gcc\\|stdc++\\)//g'`
+
TEST_READELF = $(top_builddir)/../binutils/readelf
TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
@@ -982,8 +988,8 @@ odr_violation1.so: odr_violation1.cc gcctestdir/ld
odr_violation2.so: odr_violation2.cc gcctestdir/ld
$(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
- @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
- @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
+ @echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
+ @if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
then \
echo 1>&2 "Link of debug_msg_so should have failed"; \
rm -f $@; \
@@ -1001,8 +1007,8 @@ odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
$(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
- @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so "2>$@"
- @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so 2>$@; \
+ @echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so -shared-libgcc -Bdynamic -lstdc++ "2>$@"
+ @if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so -shared-libgcc -Bdynamic -lstdc++ 2>$@; \
then \
echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
rm -f $@; \
More information about the Binutils
mailing list