diff options
author | Paul Brook <paul@codesourcery.com> | 2011-09-13 12:48:33 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2011-09-13 12:48:33 +0000 |
commit | 1e874273f8d6e8a7bdfe7bc76fceb7d20d1f1ef2 (patch) | |
tree | 919ab69e4bf163c2220a80d2baee8cd54fe40723 /libstdc++-v3 | |
parent | 3e0cef6dddb0eeba482ef43bbca8eeac4b57666a (diff) | |
download | gcc-1e874273f8d6e8a7bdfe7bc76fceb7d20d1f1ef2.zip gcc-1e874273f8d6e8a7bdfe7bc76fceb7d20d1f1ef2.tar.gz gcc-1e874273f8d6e8a7bdfe7bc76fceb7d20d1f1ef2.tar.bz2 |
arm.h (ASM_PREFERRED_EH_DATA_FORMAT): Define.
2011-09-13 Paul Brook <paul@codesourcery.com>
gcc/
* config/arm/arm.h (ASM_PREFERRED_EH_DATA_FORMAT): Define.
(ARM_TARGET2_DWARF_FORMAT): Provide default definition.
* config/arm/linux-eabi.h (ARM_TARGET2_DWARF_FORMAT): Define.
* config/arm/symbian.h (ARM_TARGET2_DWARF_FORMAT): Define.
* config/arm/uclinux-eabi.h(ARM_TARGET2_DWARF_FORMAT): Define.
* config/arm/t-bpabi (EXTRA_HEADERS): Add unwind-arm-common.h.
* config/arm/t-symbian (EXTRA_HEADERS): Add unwind-arm-common.h.
* config/c6x/c6x.c (c6x_output_file_unwind): Don't rely on dwarf2 code
enabling unwind tables.
(c6x_debug_unwind_info): New function.
(TARGET_ARM_EABI_UNWINDER): Define.
(TARGET_DEBUG_UNWIND_INFO): Define.
* config/c6x/c6x.h (DWARF_FRAME_RETURN_COLUMN): Define.
(TARGET_EXTRA_CFI_SECTION): Remove.
* config/c6x/t-c6x-elf (EXTRA_HEADERS): Set.
* ginclude/unwind-arm-common.h: New file.
libgcc/
* config.host (tic6x-*-*): Add c6x/t-c6x-elf. Set unwind_header.
* unwind-c.c (PERSONALITY_FUNCTION): Use UNWIND_POINTER_REG.
* unwind-arm-common.inc: New file.
* config/arm/unwind-arm.c: Use unwind-arm-common.inc.
* config/arm/unwind-arm.h: Use unwind-arm-common.h.
(_GLIBCXX_OVERRIDE_TTYPE_ENCODING): Define.
* config/c6x/libunwind.S: New file.
* config/c6x/pr-support.c: New file.
* config/c6x/unwind-c6x.c: New file.
* config/c6x/unwind-c6x.h: New file.
* config/c6x/t-c6x-elf: New file.
libstdc++-v3/
* libsupc++/eh_arm.cc (__cxa_end_cleanup): Add C6X implementation.
* libsupc++/eh_call.cc (__cxa_call_unexpected): Set rtti_base.
* libsupc++/eh_personality.cc (NO_SIZE_OF_ENCODED_VALUE): Remove
__ARM_EABI_UNWINDER__ check.
(parse_lsda_header): Check _GLIBCXX_OVERRIDE_TTYPE_ENCODING.
(get_ttype_entry): Use generic implementation on ARM EABI.
(check_exception_spec): Use _Unwind_decode_typeinfo_ptr and
UNWIND_STACK_REG.
(PERSONALITY_FUNCTION): Set ttype_base.
From-SVN: r178808
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 12 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_arm.cc | 44 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_call.cc | 5 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/eh_personality.cc | 58 |
4 files changed, 84 insertions, 35 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 265fcf2..4631abc 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2011-09-13 Paul Brook <paul@codesourcery.com> + + * libsupc++/eh_arm.cc (__cxa_end_cleanup): Add C6X implementation. + * libsupc++/eh_call.cc (__cxa_call_unexpected): Set rtti_base. + * libsupc++/eh_personality.cc (NO_SIZE_OF_ENCODED_VALUE): Remove + __ARM_EABI_UNWINDER__ check. + (parse_lsda_header): Check _GLIBCXX_OVERRIDE_TTYPE_ENCODING. + (get_ttype_entry): Use generic implementation on ARM EABI. + (check_exception_spec): Use _Unwind_decode_typeinfo_ptr and + UNWIND_STACK_REG. + (PERSONALITY_FUNCTION): Set ttype_base. + 2011-09-12 Daniel Krugler <daniel.kruegler@googlemail.com> Paolo Carlini <paolo.carlini@oracle.com> diff --git a/libstdc++-v3/libsupc++/eh_arm.cc b/libstdc++-v3/libsupc++/eh_arm.cc index e7ba2e5..0f0b026 100644 --- a/libstdc++-v3/libsupc++/eh_arm.cc +++ b/libstdc++-v3/libsupc++/eh_arm.cc @@ -155,6 +155,49 @@ __gnu_end_cleanup(void) return &header->unwindHeader; } +#ifdef __TMS320C6X__ +// Assembly wrapper to call __gnu_end_cleanup without clobbering +// function arguments to _Unwind_Resume. +asm (".global __cxa_end_cleanup\n" +" .type __cxa_end_cleanup, \"function\"\n" +"__cxa_end_cleanup:\n" +" stw .d2t2 B9, *B15--[10]\n" +" stw .d2t2 B8, *+B15[9]\n" +" stw .d2t2 B7, *+B15[8]\n" +" stw .d2t2 B6, *+B15[7]\n" +" stw .d2t2 B5, *+B15[6]\n" +" stw .d2t2 B4, *+B15[5]\n" +" stw .d2t1 A9, *+B15[4]\n" +" stw .d2t1 A8, *+B15[3]\n" +" stw .d2t1 A7, *+B15[2]\n" +" stw .d2t1 A6, *+B15[1]\n" +#ifdef _TMS320C6400_PLUS +" callp .s2 (__gnu_end_cleanup), B3\n" +#elif defined(_TMS320C6400) +" call .s2 (__gnu_end_cleanup)\n" +" addkpc .s2 1f, B3, 0\n" +" nop 4\n" +"1:\n" +#else +" call .s2 (__gnu_end_cleanup)\n" +" mvkl .s2 1f, B3\n" +" mvkh .s2 1f, B3\n" +" nop 3\n" +"1:\n" +#endif +" ldw .d2t1 *+B15[1], A6\n" +" ldw .d2t1 *+B15[2], A7\n" +" ldw .d2t1 *+B15[3], A8\n" +" ldw .d2t1 *+B15[4], A9\n" +" ldw .d2t2 *+B15[5], B4\n" +" ldw .d2t2 *+B15[6], B5\n" +" ldw .d2t2 *+B15[7], B6\n" +" ldw .d2t2 *+B15[8], B7\n" +" ldw .d2t2 *+B15[9], B8\n" +" ldw .d2t2 *++B15[10], B9\n" +" b .s2 _Unwind_Resume\n" +" nop 5\n"); +#else // Assembly wrapper to call __gnu_end_cleanup without clobbering r1-r3. // Also push r4 to preserve stack alignment. #ifdef __thumb__ @@ -179,5 +222,6 @@ asm (" .pushsection .text.__cxa_end_cleanup\n" " bl\t_Unwind_Resume @ Never returns\n" " .popsection\n"); #endif +#endif #endif diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc index f519f35..a6a55a4 100644 --- a/libstdc++-v3/libsupc++/eh_call.cc +++ b/libstdc++-v3/libsupc++/eh_call.cc @@ -73,6 +73,7 @@ __cxa_call_unexpected(void* exc_obj_in) int rtti_count = 0; _Unwind_Word rtti_stride = 0; _Unwind_Word* rtti_list = NULL; + _Unwind_Ptr rtti_base = 0; bool foreign_exception; std::unexpected_handler unexpectedHandler = NULL; std::terminate_handler terminateHandler = NULL; @@ -84,7 +85,7 @@ __cxa_call_unexpected(void* exc_obj_in) unexpectedHandler = xh->unexpectedHandler; terminateHandler = xh->terminateHandler; rtti_count = exc_obj->barrier_cache.bitpattern[1]; - + rtti_base = (_Unwind_Ptr) exc_obj->barrier_cache.bitpattern[2]; rtti_stride = exc_obj->barrier_cache.bitpattern[3]; rtti_list = (_Unwind_Word*) exc_obj->barrier_cache.bitpattern[4]; foreign_exception = false; @@ -134,7 +135,7 @@ __cxa_call_unexpected(void* exc_obj_in) _Unwind_Word offset; offset = (_Unwind_Word) &rtti_list[n * (rtti_stride >> 2)]; - offset = _Unwind_decode_target2(offset); + offset = _Unwind_decode_typeinfo_ptr(rtti_base, offset); catch_type = (const std::type_info*) (offset); if (__cxa_type_match(&new_xh->unwindHeader, catch_type, false, diff --git a/libstdc++-v3/libsupc++/eh_personality.cc b/libstdc++-v3/libsupc++/eh_personality.cc index 19c2044..729d688 100644 --- a/libstdc++-v3/libsupc++/eh_personality.cc +++ b/libstdc++-v3/libsupc++/eh_personality.cc @@ -30,11 +30,8 @@ #include <cxxabi.h> #include "unwind-cxx.h" -using namespace __cxxabiv1; -#ifdef __ARM_EABI_UNWINDER__ -#define NO_SIZE_OF_ENCODED_VALUE -#endif +using namespace __cxxabiv1; #include "unwind-pe.h" @@ -70,6 +67,11 @@ parse_lsda_header (_Unwind_Context *context, const unsigned char *p, info->ttype_encoding = *p++; if (info->ttype_encoding != DW_EH_PE_omit) { +#if _GLIBCXX_OVERRIDE_TTYPE_ENCODING + /* Older ARM EABI toolchains set this value incorrectly, so use a + hardcoded OS-specific format. */ + info->ttype_encoding = _GLIBCXX_OVERRIDE_TTYPE_ENCODING; +#endif p = read_uleb128 (p, &tmp); info->TType = p + tmp; } @@ -85,21 +87,22 @@ parse_lsda_header (_Unwind_Context *context, const unsigned char *p, return p; } -#ifdef __ARM_EABI_UNWINDER__ - // Return an element from a type table. -static const std::type_info* -get_ttype_entry(lsda_header_info* info, _uleb128_t i) +static const std::type_info * +get_ttype_entry (lsda_header_info *info, _uleb128_t i) { _Unwind_Ptr ptr; - ptr = (_Unwind_Ptr) (info->TType - (i * 4)); - ptr = _Unwind_decode_target2(ptr); - + i *= size_of_encoded_value (info->ttype_encoding); + read_encoded_value_with_base (info->ttype_encoding, info->ttype_base, + info->TType - i, &ptr); + return reinterpret_cast<const std::type_info *>(ptr); } +#ifdef __ARM_EABI_UNWINDER__ + // The ABI provides a routine for matching exception object types. typedef _Unwind_Control_Block _throw_typet; #define get_adjusted_ptr(catch_type, throw_type, thrown_ptr_p) \ @@ -127,7 +130,7 @@ check_exception_spec(lsda_header_info* info, _throw_typet* throw_type, if (tmp == 0) return false; - tmp = _Unwind_decode_target2((_Unwind_Word) e); + tmp = _Unwind_decode_typeinfo_ptr(info->ttype_base, (_Unwind_Word) e); // Match a ttype entry. catch_type = reinterpret_cast<const std::type_info*>(tmp); @@ -157,7 +160,7 @@ save_caught_exception(struct _Unwind_Exception* ue_header, const unsigned char* action_record __attribute__((__unused__))) { - ue_header->barrier_cache.sp = _Unwind_GetGR(context, 13); + ue_header->barrier_cache.sp = _Unwind_GetGR(context, UNWIND_STACK_REG); ue_header->barrier_cache.bitpattern[0] = (_uw) thrown_ptr; ue_header->barrier_cache.bitpattern[1] = (_uw) handler_switch_value; @@ -205,20 +208,6 @@ empty_exception_spec (lsda_header_info *info, _Unwind_Sword filter_value) typedef const std::type_info _throw_typet; -// Return an element from a type table. - -static const std::type_info * -get_ttype_entry (lsda_header_info *info, _uleb128_t i) -{ - _Unwind_Ptr ptr; - - i *= size_of_encoded_value (info->ttype_encoding); - read_encoded_value_with_base (info->ttype_encoding, info->ttype_base, - info->TType - i, &ptr); - - return reinterpret_cast<const std::type_info *>(ptr); -} - // Given the thrown type THROW_TYPE, pointer to a variable containing a // pointer to the exception object THROWN_PTR_P and a type CATCH_TYPE to // compare against, return whether or not there is a match and if so, @@ -390,7 +379,8 @@ PERSONALITY_FUNCTION (int version, case _US_UNWIND_FRAME_STARTING: actions = _UA_CLEANUP_PHASE; if (!(state & _US_FORCE_UNWIND) - && ue_header->barrier_cache.sp == _Unwind_GetGR(context, 13)) + && ue_header->barrier_cache.sp == _Unwind_GetGR(context, + UNWIND_STACK_REG)) actions |= _UA_HANDLER_FRAME; break; @@ -410,10 +400,10 @@ PERSONALITY_FUNCTION (int version, // The dwarf unwinder assumes the context structure holds things like the // function and LSDA pointers. The ARM implementation caches these in - // the exception header (UCB). To avoid rewriting everything we make the - // virtual IP register point at the UCB. + // the exception header (UCB). To avoid rewriting everything we make a + // virtual scratch register point at the UCB. ip = (_Unwind_Ptr) ue_header; - _Unwind_SetGR(context, 12, ip); + _Unwind_SetGR(context, UNWIND_POINTER_REG, ip); #else __cxa_exception* xh = __get_exception_header_from_ue(ue_header); @@ -679,6 +669,8 @@ PERSONALITY_FUNCTION (int version, if (handler_switch_value < 0) { parse_lsda_header (context, language_specific_data, &info); + info.ttype_base = base_of_encoded_value (info.ttype_encoding, + context); #ifdef __ARM_EABI_UNWINDER__ const _Unwind_Word* e; @@ -692,8 +684,8 @@ PERSONALITY_FUNCTION (int version, // Count. ue_header->barrier_cache.bitpattern[1] = n; - // Base (obsolete) - ue_header->barrier_cache.bitpattern[2] = 0; + // Base + ue_header->barrier_cache.bitpattern[2] = info.ttype_base; // Stride. ue_header->barrier_cache.bitpattern[3] = 4; // List head. |