Richard Henderson <r...@redhat.com> writes: > On 01/25/2012 12:03 AM, Rainer Orth wrote: >>> Er.. how did we get two copies? >> >> The link line boils down to >> >> ld -o eh-1.exe crt1.o crti.o crtbegin.o eh-1.o -litm -lstdc++ -lm -lgcc >> -lgcc_eh -lc -lgcc -lgcc_eh crtend.o crtn.o >> >> The eh-1.o reference to _Unwind_Resume drags in one copy of the unwinder >> from libgcc_eh.a, while libstdc++.so is linked against libgcc_s.so.1, >> providing another copy. > > So... are we linking with the gcc binary, not the g++ binary? > Because I thought -shared-libgcc is the default for C++. > > If this goes too far down a rat-hole, your original patch is ok.
The compiler used is currently set in libitm.exp (libitm_init) without considering the language used. Changing this seems too risky for stage4. I think we can get away with the following patch instead, which hardcodes -shared-libgcc for C++. I think it is safe even with --disable-shared since -shared-libgcc is simply ignored AFAICS, and is already used unconditionally in libffi.special/special.exp. Tested on i386-pc-solaris2.11. Ok for mainline? Rainer 2012-01-28 Rainer Orth <r...@cebitec.uni-bielefeld.de> PR libstdc++/51296 * testsuite/libitm.c++/c++.exp (lang_link_flags): Add -shared-libgcc. Correct libgomp references.
# HG changeset patch # Parent 707821cb5b73761684848cdd143b741881b067ce Link eh-1.exe with -shared-libgcc on Solaris (PR libitm/51822) diff --git a/libitm/testsuite/libitm.c++/c++.exp b/libitm/testsuite/libitm.c++/c++.exp --- a/libitm/testsuite/libitm.c++/c++.exp +++ b/libitm/testsuite/libitm.c++/c++.exp @@ -1,3 +1,5 @@ +# Copyright (C) 2011, 2012 Free Software Foundation, Inc. +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -17,14 +19,16 @@ load_lib libitm-dg.exp global shlib_ext set shlib_ext [get_shlib_extension] -set lang_link_flags "-lstdc++" +# The C++ tests should be linked with g++, which defaults to -shared-libgcc. +# Doing that is currently too intrusive, so hardcode here. +set lang_link_flags "-shared-libgcc -lstdc++" set lang_test_file_found 0 set lang_library_path "../libstdc++-v3/src/.libs" # Initialize dg. dg-init -set blddir [lookfor_file [get_multilibs] libgomp] +set blddir [lookfor_file [get_multilibs] libitm] if { $blddir != "" } { @@ -41,7 +45,7 @@ if { $blddir != "" } { } } elseif { [info exists GXX_UNDER_TEST] } { set lang_test_file_found 1 - # Needs to exist for libgomp.exp. + # Needs to exist for libitm.exp. set lang_test_file "" } else { puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
-- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University