No unwind info for __do_global_ctors_aux / _init?

Ian Lance Taylor iant@google.com
Wed Mar 10 15:52:00 GMT 2010


Lassi Tuura <lat@cern.ch> writes:

> I maintain a profiling utility which uses libunwind to capture stack
> traces on x86-64. One of the several problems we ran into is that
> stack tracing stops at global constructors for dynamically loaded
> shared libraries. This seems to be because there is no unwind
> information for _init / __do_global_ctors_aux.
>
> Is there any way to coax GCC to generate .eh_frame information for
> these functions?

You could try modifying the gcc Makefile to add -funwind-tables or
-fasynchronous-unwind-tables to CRTSTUFF_CFLAGS.

> I tried recompiling one library with and without
> -fasynchronous-unwind-tables on a RHEL5-derived system with GCC
> 4.3.4 + binutils 2.19.1, but didn't get the extra unwind info. In
> fact -fasynchronous-unwind-tables didn't make any difference that I
> could tell.

-fasynchronous-unwind-tables should make a difference, and it is
required if you want to be able to reliably unwind the stack from a
signal handler.

By the way, if you aren't using mainline gcc I think you'll find that
the unwind information is incorrect in function epilogues, which means
that unwinding the stack from a signal handler will break if the
signal comes in as a function is returning.  I think this may be fixed
in mainline.

Ian



More information about the Gcc-help mailing list