This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[arm] Use EABI unwind library


The first attached patche makes gcc generate ARM EABI compliant unwinding 
tables on relevant targets, and implement the unwinding routines in libgcc. 
The second patch makes the corresponding libstdc++ changes.

Everything except arm-none-eabi and arm-none-symbianelf should be unaffected.

There are a few more tweaks needed for full conformance, but these patches 
contain the bulk of the changes.

The main conceptual difference between the ia64/dwarf2 unwinder and the arm 
eabi unwinder is that with the ia64 unwinder all frame unwinding is done 
under control of the unwind library. With the arm unwinder the actual frame 
unwinding is done by the language specific personality routine.

The ARM EABI defines personality routines and langage specific data areas for 
handling C++ exceptions. However these do not fit with the algorithms 
currently used to identify exception regions. The arm scheme uses multiple 
overlapping regions with one action per region. The gcc scheme uses discrete 
recuions with multiple actions per region. This leaves two options:
a) Rewrite chunks of gcc/except.c
b) Provide a custom personality routine that uses tables similar to teh 
existing dwarf2 unwinder.

I chose option (b) to avoid having two different versions of what looks like 
fairly hairy code, four after it's been backported to 3.4 for CodeSourcery 
customers.

The libstdc++ code ended up with a few more #ifdefs that I'd like. However the 
only alternative I see is to duplicate the whole libsupc++/eh_personality.cc, 
which seems worse.

My motivation for creating libsupc++/eh_call.cc was that the arm personality 
routine is designed to be independent of the C++ library. It should be 
possible to compile eh_personality.cc for an EABI target, and have g++ code 
work with any EABI compliant unwind library and C++ library.

Bootstrapped and tested on i686, and tested with cross to arm-none-elf and 
arm-none-eabi.
Ok for csl-arm-branch?
Do we also want this for mainline?

N.B. This patch requires as-yet unapplied binutils patches for EABI unwind 
table generation.

Paul

gcc/
2004-09-21  Paul Brook  <paul@codesourcery.com>

 * Makefile.in (USER_H): Add unwind-arm.h.
 * except.c (fnspec_ttable_indirect): Add.
 (init_eh): Set it.
 (add_ehspec_entry): Handle fnspec_ttable_indirect.
 (output_ttype): New function.
 (output_function_exception_table): Use it.  Handle
 fnspec_ttable_indirect.
 * target-def.h (TARGET_ASM_TTYPE): Define.
 (TARGET_EH_FNSPEC_TTABLE_INDIRECT): Ditto.
 * target.h (struct gcc_target): Add asm_out.ttype and
 eh_fnspec_ttable_indirect.
 * unwind-arm.h: New file.
 * unwind-c.c (CONTINUE_UNWINDING): Define.
 (PERSONALITY_FUNCTION): Add ARM EABI prototype and initialization
 code.  Use CONTINUE_UNWINDING.
 * unwind.h: Include unwind-arm.h when using ARM EABI unwinder.
 * config/arm/arm.c (arm_unwind_emit, arm_output_ttype): New functions.
 (arm_unwind_emit_stm, arm_unwind_emit_set): New functions.
 (TARGET_UNWIND_EMIT, TARGET_ASM_TTYPE): Define.
 (TARGET_EH_FNSPEC_TTABLE_INDIRECT): Ditto.
 (thumb_pushpop, thumb_output_function_prologue): Output frame
 unwinding directives.
 * config/arm/arm.h (MUST_USE_SJLJ_EXCEPTIONS): Only define when
 !TARGET_UNWIND_INFO.
 * config/arm/bpabi.h (TARGET_UNWIND_INFO): Define.
 * config/arm/elf.h (ASM_DECLARE_FUNCTION_NAME,
 ASM_DECLARE_FUNCTION_SIZE): Output frame unwinding annotatons.
 * config/arm/lib1funcs.asm: Include libunwind.s
 * config/arm/libunwind.S: New file.
 * config/arm/t-bpabi (LIB1ASMFUNCS): Add _unwind.
 (LIB2ADDEH, LIB2ADDEHDEP): Set.
 * config/arm/t-symbian (LIB2ADDEH, LIB2ADDEHDEP): Set.
 * config/arm/unwind-arm.c: New file.
 * doc/tm.texi: Document TARGET_ASM_TTYPE and
 TARGET_EH_FNSPEC_TTABLE_INDIRECT.

libstdc++/
2004-09-21  Paul Brook  <paul@codesourcery.com>

 Add support for ARM EABI unwinding library.
 * libsupc++/Makefile.am (sources): Add eh_arm.cc and eh_call.cc.
 * libsupc++/Makefile.in: Regenerate.
 * libsupc++/eh_arm.cc: New file.
 * libsupc++/eh_call.cc: New file.
 * libsupc++/eh_catch.cc (__cxa_begin_catch): Call _Unwind_Complete.
 Use __is_gxx_exception_class.
 (__cxa_end_catch): Use __is_gxx_exception_class.
 * libsupc++/eh_personality.cc (NO_SIZE_OF_ENCODED_VALUE): Define if
 using ARM EABI unwinder.
 (_throw_typet): Declare.
 (check_exception_spec, get_ttype_entry, get_adjusted_ptr): Add
 ARM EABI implementations.
 (CONTINUE_UNWINDING): Define.
 (PERSONALITY_FUNCTION): Use CONTINUE_UNWINDING and
 __cxa_call_terminate.  Add Support for ARM EABI.  Including changes
 to function prototype, initialization code, exception object format,
 and calling __cxa_begin_cleanup.
 (__cxa_call_unexpected): Disable on arm systems.
 * libsupc++/eh_throw.cc (__cxa_throw): Use __GXX_INIT_EXCEPTION_CLASS.
 (__cxa_rethrow): Use __is_gxx_exception_class.  Always call
 _Unwind_RaiseException on ARM EABI targets.
 * libsupc++/unwind-cxx.h (__cxa_call_terminate): Declare.
 (__cxa_type_match, __cxa_begin_cleanup, __cxa_end_cleanup): Declare.
 (__is_gxx_exception_class, __GXX_INIT_EXCEPTION_CLASS): Define.

Attachment: patch.unwind_eabi.gz
Description: GNU Zip compressed data

Attachment: patch.v3_unwind.gz
Description: GNU Zip compressed data


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