------- Comment #3 from rwild at gcc dot gnu dot org  2010-03-30 16:58 -------
Bug also happens with

$ g++ -v
Using built-in specs.
COLLECT_GCC=/opt/bin/g++
COLLECT_LTO_WRAPPER=/opt/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure -C --enable-maintainer-mode --prefix=/opt
--with-libelf=/opt --enable-lto --without-cloog --without-ppl --with-mpc=/opt
--enable-gold LD=/opt/bin/ld LD_FOR_TARGET=/opt/bin/ld
--enable-languages=c,c++,fortran,java,lto,objc,obj-c++
Thread model: posix
gcc version 4.5.0 20100329 (experimental) (GCC) 

and

$ /opt/bin/ld -v
GNU gold (GNU Binutils 2.20.51.20100319) 1.9

$ /lib/libc.so.6
GNU C Library stable release version 2.7, by Roland McGrath et al.

But my overriding of LD_LIBRARY_PATH was bogus, as it was wrongly removing
/opt/lib64 which is where the just-installed libstdc++.so.6 lives.  Sorry about
the testcase reduction error (libtool --mode=execute prepends to
LD_LIBRARY_PATH rather than overriding it).


I still see the original testsuite error, though only with '-flto
-fuse-linker-plugin' (adjusting bug title and keywords).  So, from the original
error description, grab the source files, then

CXX='g++'
CXXFLAGS='-O2 -flto'
LDFLAGS=-fuse-linker-plugin
$CXX $CXXFLAGS -c main.cpp
$CXX $CXXFLAGS -c lib.cpp  -fPIC
$CXX -fPIC -shared $CXXFLAGS $LDFLAGS lib.o -Wl,-soname -Wl,liba.so.1 -o
liba.so.1
ln -sf liba.so.1 liba.so
$CXX $CXXFLAGS $LDFLAGS -o main main.o -L. -la
LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ./main

leads to

Aborted (core dumped)

with a backtrace of

#0  0x00007fc2ae066095 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00007fc2ae066095 in raise () from /lib/libc.so.6
#1  0x00007fc2ae067af0 in abort () from /lib/libc.so.6
#2  0x00007fc2ae6f94bd in uw_update_context_1 (context=0x7fff7fe51010,
fs=0x7fff7fe50e90) at ../../../gcc/libgcc/../gcc/unwind-pe.h:155
#3  0x00007fc2ae6f97d9 in uw_update_context (context=0x7fff7fe51010,
fs=0x7fff7fe50e90) at ../../../gcc/libgcc/../gcc/unwind-pe.h:155
#4  0x00007fc2ae6fa40b in _Unwind_RaiseException (exc=0x4030b0) at
../../../gcc/libgcc/../gcc/unwind-pe.h:155
#5  0x00007fc2ae7dba31 in __cxa_throw (obj=<value optimized out>, tinfo=<value
optimized out>, dest=<value optimized out>) at
../../../../gcc/libstdc++-v3/libsupc++/eh_throw.cc:78
#6  0x00007fc200000000 in ?? ()
#7  0x00007fff7fe51408 in ?? ()
#8  0x00007fff7fe513f8 in ?? ()
#9  0x0000000000403028 in ?? ()
#10 0x0000000000000000 in ?? ()

It even fails without -O2, the backtrace is then

#0  0x00007f44e1705095 in raise () from /lib/libc.so.6
#1  0x00007f44e1706af0 in abort () from /lib/libc.so.6
#2  0x00007f44e1e7b6ed in __gnu_cxx::__verbose_terminate_handler () at
../../../../gcc/libstdc++-v3/libsupc++/vterminate.cc:93
#3  0x00007f44e1e79906 in __cxxabiv1::__terminate (handler=<value optimized
out>) at ../../../../gcc/libstdc++-v3/libsupc++/eh_terminate.cc:39
#4  0x00007f44e1e79933 in std::terminate () at
../../../../gcc/libstdc++-v3/libsupc++/eh_terminate.cc:49
#5  0x00007f44e1e79a3e in __cxa_throw (obj=<value optimized out>, tinfo=<value
optimized out>, dest=<value optimized out>) at
../../../../gcc/libstdc++-v3/libsupc++/eh_throw.cc:83
#6  0x00007f44e1ecdac7 in libbar () from /tmp/a/liba.so.1
#7  0x00007f44e1ecdb5c in libfoo () from /tmp/a/liba.so.1
#8  0x00000000004010e2 in exceptions_in_lib ()
#9  0x000000000040116e in main ()

If I add -g to '-O2 -flto', the backtrace is

#0  0x00007fd0d5b75095 in raise () from /lib/libc.so.6
#1  0x00007fd0d5b76af0 in abort () from /lib/libc.so.6
#2  0x00007fd0d6207504 in execute_cfa_program (insn_ptr=0x7fd0d628aabd "",
insn_end=0x7fd0d628b717 "E", context=0x7fffc0cf93a0, fs=0x7fffc0cf9220) at
../../../gcc/libgcc/../gcc/unwind-pe.h:155
#3  0x00007fd0d6208a78 in uw_frame_state_for (context=0x7fffc0cf93a0,
fs=0x7fffc0cf9220) at ../../../gcc/libgcc/../gcc/unwind-pe.h:155
#4  0x00007fd0d6209416 in _Unwind_RaiseException (exc=0x4030b0) at
../../../gcc/libgcc/../gcc/unwind-pe.h:155
#5  0x00007fd0d62eaa31 in __cxa_throw (obj=<value optimized out>, tinfo=<value
optimized out>, dest=<value optimized out>) at
../../../../gcc/libstdc++-v3/libsupc++/eh_throw.cc:78
#6  0x00007fd0d633e57e in libbar () from /tmp/a/liba.so.1
#7  0x00007fffc0cf9788 in ?? ()
#8  0x0000000000403028 in ?? ()
#9  0x0000000000000000 in ?? ()


Without -fuse-linker-plugin, it passes for me.

I get a similar failure for exceptions from dlopen'ed modules, if you like I
can provide a testcase for that as well.


-- 

rwild at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |lto
            Summary|[4.5 Regression] exception  |[4.5 Regression] exception
                   |handling broken across      |handling broken across
                   |shared libaries             |shared libaries with -fuse-
                   |                            |linker-plugin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43581

Reply via email to