4 msgQuestions about __attribute((cold))
3 msghow to initialize union?
4 msgOn the C99 Status
1 msgProblem with GCC 4.2 and above
5 msgHelp!!! build failed for GCC-3.2.3
1 msgPassing array variable as Input Constraint to l...

Exception handling on AIX5.3 with gcc 3.4.6
\ Shlom Marom (20 Mar 2008)
. \ Brian Dessent (20 Mar 2008)
. . \ Shlom Marom (21 Mar 2008)
. . \ Ian Lance Taylor (26 Mar 2008)
. \ David Edelsohn (20 Mar 2008)
. \ Brian Dessent (22 Mar 2008)
. . \ Shlom Marom (23 Mar 2008)

1 msgINT64
1 msgPassing array variable address as Input Constra...
3 msgDynamic compilation using gcc
3 msgWhat does the version number of gcc mean ?
1 msgCome join me on ssbbw4u...
3 msg64-bit write() system call
23 msgtry, finally
3 msgstack variables and loops
2 msgHow can I get the dump file which is in SSA form ?
1 msgSie wurden ins RotlichtVZ eingeladen
2 msgModifying the std C libraries
1 msgRe: An error occured when building gcc4.3.0
5 msgStrange syntax error problem with mmorpg-framework
Subject:Re: Exception handling on AIX5.3 with gcc 3.4.6
Group:Gcc-help
From:Ian Lance Taylor
Date:26 Mar 2008


Brian Dessent <brian> writes:

> Shlom Marom wrote:
>
>> If I compiled the program with shared lib-gcc and with the pthread
>> libstdc++ - everything works fine and also the base exception is being
>> caught as it should.
>> ...
>> Shared linking: gcc -o tester_shared main.cpp -pthread -I.
>> -shared-libgcc -L/usr/lib -ldl -lpthread -lstdc++
>> Static linking: gcc -o tester_static main.cpp -L/usr/lib/threads
>> -pthread -I. -static-libgcc -L/usr/lib -ldl -lpthread `gcc
>
> A shared libgcc is pretty much required for proper exception handling, I
> just don't think you're going to be able to get around that. This
> should hold true for pretty much every target so the fact that it works
> with static libgcc on Linux is by accident, or perhaps luck.

Brian's answer is in general correct. However, there is a case where
it works. You can use -static-libgcc when throwing exceptions across
shared library boundaries if:

1) gcc is configured to use unwind-dw2-glibc-fde.c instead of
unwind-dw2-glibc.c (this happens on GNU/Linux systems and some
others--look for uses of t-linux or t-libunwind-elf in
gcc/config.gcc).

2) gcc is configured to pass --eh-frame-hdr to the linker (this
happens automatically if the linker available when configuring gcc
supports this option).

3) The executable and all shared libraries were in fact built by a gcc
which passes --eh-frame-hdr to the linker.

4) Your C library has a working copy of dl_iterate_phdr (this is true
for recent versions of glibc on GNU/Linux).

If all those conditions are true, then unwind information does not
need to be registered at program startup. Instead, the unwind library
will find it at runtime using dl_iterate_phdr to look for
PT_GNU_EH_FRAME segments created by the linker. And in that case
-static-libgcc will work.

Ian


© 2004-2008 readlist.com