diff options
author | Paul Brook <paul@codesourcery.com> | 2005-06-28 19:52:27 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2005-06-28 19:52:27 +0000 |
commit | 617a1b714435a270ccf699c4c6e17767088e2242 (patch) | |
tree | c9a2afea8c3e3d2ed63f6bfa76d8c96c5534d972 /gcc/except.c | |
parent | 3176a0c28f6c38963c5beecdbbd44a91b62fc8eb (diff) | |
download | gcc-617a1b714435a270ccf699c4c6e17767088e2242.zip gcc-617a1b714435a270ccf699c4c6e17767088e2242.tar.gz gcc-617a1b714435a270ccf699c4c6e17767088e2242.tar.bz2 |
Makefile.in: Set and use UNWIND_H.
2005-06-28 Paul Brook <paul@codesourcery.com>
gcc/
* Makefile.in: Set and use UNWIND_H. Install as unwind.h.
* c-decl.c (finish_decl): Call default_init_unwind_resume_libfunc.
* except.c (add_ehspec_entry): Generate arm eabi filter lists.
(assign_filter_values): Ditto.
(output_ttype): New function.
(output_function_exception_table): Use output_ttype. Generate arm
eabi filter lists.
(default_init_unwind_resume_libfunc): New function.
* except.h (default_init_unwind_resume_libfunc): Add prototype.
* optabs.c (init_optabs): Don't set unwind_resume_libfunc.
* opts.c (decode_options): Use targetm.unwind_tables_default.
* target-def.h (TARGET_ASM_TTYPE): Provide and use definition.
(TARGET_ARM_EABI_UNWINDER, TARGET_UNWIND_TABLES_DEFAULT): Ditto.
* target.h (struct gcc_target): Add asm.ttype, unwind_tables_default
and arm_eabi_unwinder.
* unwind-c.c: Support Arm EABI unwinder.
* unwind.h: Rename ...
* unwind-generic.h: ... To this.
* doc/tm.texi (TARGET_ASM_TTYPE, TARGET_ARM_EABI_UNWINDER): Document.
(TARGET_UNWID_TABLES_DEFAULT): Document.
* config/arm/arm-protos.h (arm_output_fn_unwind): Add prototype.
* config/arm/arm.c (arm_unwind_emit, arm_output_ttype): New functions.
(TARGET_UNWIND_EMIT, TARGET_ASM_TTYPE, TARGET_ARM_EABI_UNWINDER):
Define.
(thumb_pushpop, thumb_output_function_prologue): Output unwinding
directives.
(arm_unwind_emit_stm, arm_unwind_emit_set): New functions.
* config/arm/arm.h (MUST_USE_SJLJ_EXCEPTIONS): Only define when
!TARGET_UNWIND_INFO.
(ARM_OUTPUT_FN_UNWIND, ARM_EABI_UNWIND_TABLES): Define.
* config/arm/bpabi.h (TARGET_UNWIND_INFO): Define.
* config/arm/elf.h (ASM_DECLARE_FUNCTION_NAME,
ASM_DECLARE_FUNCTION_SIZE): Use ARM_OUTPUT_FN_UNWIND.
* config/arm/lib1funcs.asm: Include libunwind.S.
* config/arm/libgcc-bpabi.ver: Add unwinding routines.
* config/arm/libunwind.S: New file.
* config/arm/pr-support.c: New file.
* config/arm/t-bpabi (LIB1ASMFUNCS): Add _unwind.
(UNWIND_H, LIB2ADDEH, LIB2ADDEHDEP): Set.
* config/arm/t-symbian (UNWIND_H, LIB2ADDEH, LIB2ADDEHDEP): Set.
* config/arm/unwind-arm.c: New file.
* config/arm/unwind-arm.h: New file.
* config/i386/t-netware (USER_H): Remove unwind.h.
* config/ia64/ia64.h (TARGET_UNWIND_TABLES_DEFAULT): Define.
gcc/cp/
* Make-lang.in (cp/except.o): Depend on $(TARGET_H)
* except.c: Include target.h.
(init_exception_processing): Initialize unwind_resume_libfunc.
* doc/tm.texi: Document TARGET_ASM_TTYPE
gcc/ada/
* misc.c (gnat_init_gcc_eh): Call default_init_unwind_resume_libfunc.
gcc/java/
* decl.c (java_init_decl_processing): Call
default_init_unwind_resume_libfunc.
gcc/objc/
* objc-act.c (objc_init_exceptions): Call
default_init_unwind_resume_libfunc.
libstdc++/
* acinclude.m4 (GLIBCXX_ENABLE_SJLJ_EXCEPTIONS): Check for
__cxa_end_cleanup.
* libsupc++/Makefile.am (sources): Add eh_call.c and eh_arm.c.
* libsupc++/eh_arm.cc: New file.
* libsupc++/eh_call.cc: New file.
* libsupc++/eh_catch.cc (__cxa_get_exception_ptr): Use
__gxx_caught_object.
(__cxa_begin_catch): Ditto. Use __is_gxx_exception_class. Call
_Unwind_Complete when using the ARM EABI.
(__cxa_end_catch): Use __is_gxx_exception_class.
* libsupc++/eh_personality.cc: Define NO_SIZE_OF_ENCODED_VALUE when
using the ARM EABI.
(save_caught_exception, restore_caught_exception): New functions.
(_throw_typet): New typedef.
(get_ttype_entry, get_adjusted_ptr, check_exception_spec): Add ARM
EABI implementations.
(PERSONALITY_FUNCTION): Use new functions. Addd support for ARM EABI
unwinding libary.
(__cxa_unexpected): Disable when using the ARM EABI.
* libsupc++/eh_throw.cc (__cxa_throw): Use __GXX_INIT_EXCEPTION_CLASS.
(__cxa_rethrow): Use __is_gxx_exception_class. Call
_Unwind_RaiseException when using the ARM EABI.
* libsupc++/unwind-cxx.h (struct __cxa_exception): Add fields for ARM
EABI semantics.
(struct __cxa_eh_globals): Ditto.
(__cxa_call_terminate): Add prototype.
(__cxa_type_match, __cxa_begin_cleanup, __cxa_end_cleanup): Add
prototypes.
(__get_exception_header_from_obj, __get_exception_header_from_ue):
Move earlier in file.
(__is_gxx_exception_class, __GXX_INIT_EXCEPTION_CLASS,
__gxx_caught_object): New functions.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
* include/Makefile.in: Regenerate.
* libmath/Makefile.in: Regenerate.
* libsupc++/Makefile.in: Regenerate.
* po/Makefile.in: Regenerate.
* src/Makefie.in: Regenerate.
* testsuite/makefile.in: Regenerate.
From-SVN: r101385
Diffstat (limited to 'gcc/except.c')
-rw-r--r-- | gcc/except.c | 134 |
1 files changed, 92 insertions, 42 deletions
diff --git a/gcc/except.c b/gcc/except.c index 3c42910..1bcdc28 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -1134,12 +1134,23 @@ add_ehspec_entry (htab_t ehspec_hash, htab_t ttypes_hash, tree list) n->filter = -(VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data) + 1); *slot = n; - /* Look up each type in the list and encode its filter - value as a uleb128. Terminate the list with 0. */ + /* Generate a 0 terminated list of filter values. */ for (; list ; list = TREE_CHAIN (list)) - push_uleb128 (&cfun->eh->ehspec_data, - add_ttypes_entry (ttypes_hash, TREE_VALUE (list))); - VARRAY_PUSH_UCHAR (cfun->eh->ehspec_data, 0); + { + if (targetm.arm_eabi_unwinder) + VARRAY_PUSH_TREE (cfun->eh->ehspec_data, TREE_VALUE (list)); + else + { + /* Look up each type in the list and encode its filter + value as a uleb128. */ + push_uleb128 (&cfun->eh->ehspec_data, + add_ttypes_entry (ttypes_hash, TREE_VALUE (list))); + } + } + if (targetm.arm_eabi_unwinder) + VARRAY_PUSH_TREE (cfun->eh->ehspec_data, NULL_TREE); + else + VARRAY_PUSH_UCHAR (cfun->eh->ehspec_data, 0); } return n->filter; @@ -1157,7 +1168,10 @@ assign_filter_values (void) htab_t ttypes, ehspec; cfun->eh->ttype_data = VEC_alloc (tree, gc, 16); - VARRAY_UCHAR_INIT (cfun->eh->ehspec_data, 64, "ehspec_data"); + if (targetm.arm_eabi_unwinder) + VARRAY_TREE_INIT (cfun->eh->ehspec_data, 64, "ehspec_data"); + else + VARRAY_UCHAR_INIT (cfun->eh->ehspec_data, 64, "ehspec_data"); ttypes = htab_create (31, ttypes_filter_hash, ttypes_filter_eq, free); ehspec = htab_create (31, ehspec_filter_hash, ehspec_filter_eq, free); @@ -3377,6 +3391,54 @@ default_exception_section (void) readonly_data_section (); } + +/* Output a reference from an exception table to the type_info object TYPE. + TT_FORMAT and TT_FORMAT_SIZE descibe the DWARF encoding method used for + the value. */ + +static void +output_ttype (tree type, int tt_format, int tt_format_size) +{ + rtx value; + + if (type == NULL_TREE) + value = const0_rtx; + else + { + struct cgraph_varpool_node *node; + + type = lookup_type_for_runtime (type); + value = expand_expr (type, NULL_RTX, VOIDmode, EXPAND_INITIALIZER); + + /* Let cgraph know that the rtti decl is used. Not all of the + paths below go through assemble_integer, which would take + care of this for us. */ + STRIP_NOPS (type); + if (TREE_CODE (type) == ADDR_EXPR) + { + type = TREE_OPERAND (type, 0); + if (TREE_CODE (type) == VAR_DECL) + { + node = cgraph_varpool_node (type); + if (node) + cgraph_varpool_mark_needed_node (node); + } + } + else if (TREE_CODE (type) != INTEGER_CST) + abort (); + } + + /* Allow the target to override the type table entry format. */ + if (targetm.asm_out.ttype (value)) + return; + + if (tt_format == DW_EH_PE_absptr || tt_format == DW_EH_PE_aligned) + assemble_integer (value, tt_format_size, + tt_format_size * BITS_PER_UNIT, 1); + else + dw2_asm_output_encoded_addr_rtx (tt_format, value, NULL); +} + void output_function_exception_table (void) { @@ -3536,40 +3598,7 @@ output_function_exception_table (void) while (i-- > 0) { tree type = VEC_index (tree, cfun->eh->ttype_data, i); - rtx value; - - if (type == NULL_TREE) - value = const0_rtx; - else - { - struct cgraph_varpool_node *node; - - type = lookup_type_for_runtime (type); - value = expand_expr (type, NULL_RTX, VOIDmode, EXPAND_INITIALIZER); - - /* Let cgraph know that the rtti decl is used. Not all of the - paths below go through assemble_integer, which would take - care of this for us. */ - STRIP_NOPS (type); - if (TREE_CODE (type) == ADDR_EXPR) - { - type = TREE_OPERAND (type, 0); - if (TREE_CODE (type) == VAR_DECL) - { - node = cgraph_varpool_node (type); - if (node) - cgraph_varpool_mark_needed_node (node); - } - } - else - gcc_assert (TREE_CODE (type) == INTEGER_CST); - } - - if (tt_format == DW_EH_PE_absptr || tt_format == DW_EH_PE_aligned) - assemble_integer (value, tt_format_size, - tt_format_size * BITS_PER_UNIT, 1); - else - dw2_asm_output_encoded_addr_rtx (tt_format, value, NULL); + output_ttype (type, tt_format, tt_format_size); } #ifdef HAVE_AS_LEB128 @@ -3580,8 +3609,16 @@ output_function_exception_table (void) /* ??? Decode and interpret the data for flag_debug_asm. */ n = VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data); for (i = 0; i < n; ++i) - dw2_asm_output_data (1, VARRAY_UCHAR (cfun->eh->ehspec_data, i), - (i ? NULL : "Exception specification table")); + { + if (targetm.arm_eabi_unwinder) + { + tree type = VARRAY_TREE (cfun->eh->ehspec_data, i); + output_ttype (type, tt_format, tt_format_size); + } + else + dw2_asm_output_data (1, VARRAY_UCHAR (cfun->eh->ehspec_data, i), + (i ? NULL : "Exception specification table")); + } current_function_section (current_function_decl); } @@ -3730,4 +3767,17 @@ verify_eh_tree (struct function *fun) } } } + + +/* Initialize unwind_resume_libfunc. */ + +void +default_init_unwind_resume_libfunc (void) +{ + /* The default c++ routines aren't actually c++ specific, so use those. */ + unwind_resume_libfunc = + init_one_libfunc ( USING_SJLJ_EXCEPTIONS ? "_Unwind_SjLj_Resume" + : "_Unwind_Resume"); +} + #include "gt-except.h" |