This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libunwind problems


Hi all,

Andrew Haley tracked down our problem with linking against the libunwind library. Below is his explanation of what he found and how it can be resolved.

Thanks to Andrew Haley for his valuable time.

Rick



The problem is that you have linked frysk in such a way that it uses
part of libunwindand part of libgcc for exception handling .  So,
symbol resolution in FryskGui goes like this:

     4411:     binding file /lib/libc.so.6 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_Find_FDE' [GCC_3.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /usr/lib/libgcj.so.7 [0]: normal symbol `_ZN14_Jv_StackTrace13UnwindTraceFnEP15_Unwind_ContextPv'
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_Backtrace' [GCC_3.3]
     4411:     binding file /lib/libgcc_s.so.1 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_Find_FDE' [GCC_3.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_GetRegionStart' [GCC_3.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_GetIP' [GCC_3.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_RaiseException' [GCC_3.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_GetLanguageSpecificData' [GCC_3.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_GetIPInfo' [GCC_4.2.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_SetGR' [GCC_3.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to /lib/libgcc_s.so.1 [0]: normal symbol `_Unwind_SetIP' [GCC_3.0]
     4411:     binding file /usr/lib/libgcj.so.7 [0] to ./frysk-gui/frysk/gui/FryskGui [0]: normal symbol `_Unwind_Resume' [GCC_3.0]

Note that all of libgcj's exception handling is linked to
libgcc_s.so.1 except for `_Unwind_Resume', which is linked to the
libunwind version of that symbol that is built into FryskGui.  As far
as I can see this can never work, because the context structure used
in `_Unwind_RaiseException' and `_Unwind_Resume' must be the same, and
they must be satisfied from the same library.

FryskGui exports just _one_ libunwind function, and as soon as it gets
called the program crashes.


-bash-3.1$ nm ./frysk-gui/frysk/gui/FryskGui | grep _Unwind_ 083af4e0 T __libunwind_Unwind_Resume 083af4e0 T _Unwind_Resume


So, the way to fix frysk is to make sure that libgcc_s.so is in the link path before libunwind. This causes the libunwind version of _Unwind_Resume not to be put into FryskGui.

I linked FryskGui like this:

... mports/elfutils/libdw/:/home/aph/frysk-libunwind/build/frysk-gui/../frysk-imports/elfutils/libdwfl/:/home/aph/frysk-libunwind/build/frysk-gui/../frysk-imports/elfutils/libebl/:/home/aph/frysk-libunwind/build/frysk-gui/../frysk-imp\orts/elfutils/libelf/:/home/aph/frysk-libunwind/build/frysk-gui/../frysk-imports/libunwind/src/:/home/aph/frysk-libunwind/build/frysk-gui/../frysk-sys/:./elfutils/libdw \
-Dgnu.gcj.runtime.NameFinder.demangle=false \
-Dgnu.gcj.runtime.NameFinder.use_addr2line=false \
-lgcc_s \
frysk/gui/FryskGui.o \
libfrysk-gui.a \
../frysk-gtk/libfrysk-gtk.a ...

This problem is really due to mixing dynamic and static libraries.  I
imagine -- but I haven't tried -- that if you used a dynamically
linked version of libunwind it would be OK.

Andrew.


P.S. gcj on trunk doesn't call `_Unwind_Resume' at all; this is a 4.1 issue.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]