PATCH: Share the dwarf2 unwind code between glibc and gcc 3.0
H . J . Lu
hjl@lucon.org
Mon Jul 9 14:39:00 GMT 2001
On Mon, Jul 09, 2001 at 04:06:18PM +0200, Mark Kettenis wrote:
>
> Changing the code such that it does find the GCC 2.x exception handler
> info is almost trivial. I implemented it, and it works fine with GCC
> 2.95.2. I already posted my code once. Attached is a slightly
> improved version. The difference between this code and the origional
> code from gcc-3_0-branch are an additional member of `struct
> _Unwind_Context' and a bit of code to fetch the GCC 2.x exception
> handler info in extract_cie_info(). The missing headers can be taken
> verbatim from the GCC 3.x sources. Of course integrating this into
> glibc would still involve a bit of work, but I'm not going to invest
> my time in it while HJ is still pushing his patch.
>
Here is a new patch based on Mark's __frame_state_for. I put the
patched unwind-dw2-fde.c, unwind-dw2-fde.h and unwind-dw2.c, plus the
unpatched unwind.h and unwind-pe.h in glibc. The resulting libc.soes
compiled with gcc 2.95, 2.96 and 3.0.1 work fine with my testcases.
H.J.
----
2001-07-09 H.J. Lu (hjl@gnu.org)
* unwind-dw2-fde.c: Include glibc heade files instead if _LIBC
is defined.
(init_object_mutex_once): Define differently if _LIBC is
defined.
(object_mutex_lock): New. Defined.
(object_mutex_unlock): New. Defined.
Replace all __gthread_mutex_lock (&object_mutex) with
object_mutex_lock ().
Replace all __gthread_mutex_unlock (&object_mutex) with
object_mutex_unlock ().
* unwind-dw2-fde.h (DW_EH_flexarr): New. Defined.
Replace all [] in struct with DW_EH_flexarr.
(object): Don't define if _LIBC is defined.
Replace all fde with struct dwarf_fde.
* unwind-dw2.c: Include glibc heade files instead if _LIBC is
defined.
(NEED___frame_state_for): New. Defined if _LIBC is defined.
(STACK_GROWS_DOWNWARD): Don't define if NEED___frame_state_for
is defined.
(_Unwind_Context): Likewise.
(extract_cie_info): Likewise.
(execute_stack_op): Likewise.
(uw_frame_state_for): Likewise.
(uw_update_context_1): Likewise.
(uw_update_context): Likewise.
(uw_init_context_1): Likewise.
(init_dwarf_reg_size_table): Likewise.
(uw_install_context_1): Likewise.
(uw_identify_context): Likewise.
Don't include "unwind.inc" if NEED___frame_state_for is
defined.
(__frame_state_for): New. Based on a patch from Mark Kettenis
<kettenis@science.uva.nl>. Define if NEED___frame_state_for is
defined.
More information about the Libc-alpha
mailing list