diff options
author | pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-13 12:48:33 +0000 |
---|---|---|
committer | pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-13 12:48:33 +0000 |
commit | 7e5fc0c4013728ba367150879c8705f5e3beb05f (patch) | |
tree | 919ab69e4bf163c2220a80d2baee8cd54fe40723 /gcc | |
parent | 73cd2c42217339beb8c2a3da896f2daac37963d7 (diff) | |
download | gcc-7e5fc0c4013728ba367150879c8705f5e3beb05f.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178808 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/config/arm/arm.h | 10 | ||||
-rw-r--r-- | gcc/config/arm/linux-eabi.h | 2 | ||||
-rw-r--r-- | gcc/config/arm/symbian.h | 2 | ||||
-rw-r--r-- | gcc/config/arm/t-bpabi | 1 | ||||
-rw-r--r-- | gcc/config/arm/t-symbian | 1 | ||||
-rw-r--r-- | gcc/config/arm/uclinux-eabi.h | 1 | ||||
-rw-r--r-- | gcc/config/c6x/c6x.c | 36 | ||||
-rw-r--r-- | gcc/config/c6x/c6x.h | 3 | ||||
-rw-r--r-- | gcc/config/c6x/t-c6x-elf | 1 | ||||
-rw-r--r-- | gcc/ginclude/unwind-arm-common.h | 251 |
11 files changed, 320 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 020e8483dd3..010bb7bfafc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2011-09-13 Paul Brook <paul@codesourcery.com> + + * 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. + 2011-09-13 Georg-Johann Lay <avr@gjlay.de> PR target/50358 diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 1e8c29a1b1f..208ee517933 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -825,6 +825,16 @@ extern int arm_arch_thumb_hwdiv; #define ARM_EH_STACKADJ_REGNUM 2 #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (SImode, ARM_EH_STACKADJ_REGNUM) +#ifndef ARM_TARGET2_DWARF_FORMAT +#define ARM_TARGET2_DWARF_FORMAT DW_EH_PE_pcrel + +/* ttype entries (the only interesting data references used) + use TARGET2 relocations. */ +#define ASM_PREFERRED_EH_DATA_FORMAT(code, data) \ + (((code) == 0 && (data) == 1 && ARM_UNWIND_INFO) ? ARM_TARGET2_DWARF_FORMAT \ + : DW_EH_PE_absptr) +#endif + /* The native (Norcroft) Pascal compiler for the ARM passes the static chain as an invisible last argument (possible since varargs don't exist in Pascal), so the following is not true. */ diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h index 921af3d7f0c..a3830955948 100644 --- a/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h @@ -101,3 +101,5 @@ is used. */ #undef CLEAR_INSN_CACHE #define CLEAR_INSN_CACHE(BEG, END) not_used + +#define ARM_TARGET2_DWARF_FORMAT (DW_EH_PE_pcrel | DW_EH_PE_indirect) diff --git a/gcc/config/arm/symbian.h b/gcc/config/arm/symbian.h index b24c6ec7593..fa2ed84ed66 100644 --- a/gcc/config/arm/symbian.h +++ b/gcc/config/arm/symbian.h @@ -98,3 +98,5 @@ #define TARGET_ARM_DYNAMIC_VAGUE_LINKAGE_P false #define TARGET_DEFAULT_WORD_RELOCATIONS 1 + +#define ARM_TARGET2_DWARF_FORMAT DW_EH_PE_absptr diff --git a/gcc/config/arm/t-bpabi b/gcc/config/arm/t-bpabi index b6b5f40d723..d8a1be45dcd 100644 --- a/gcc/config/arm/t-bpabi +++ b/gcc/config/arm/t-bpabi @@ -28,3 +28,4 @@ LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c # Add the BPABI names. SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver +EXTRA_HEADERS += $(srcdir)/ginclude/unwind-arm-common.h diff --git a/gcc/config/arm/t-symbian b/gcc/config/arm/t-symbian index f074591acbe..e37d473eca0 100644 --- a/gcc/config/arm/t-symbian +++ b/gcc/config/arm/t-symbian @@ -30,6 +30,7 @@ LIB1ASMFUNCS += \ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ _fixsfsi _fixunssfsi +EXTRA_HEADERS += $(srcdir)/ginclude/unwind-arm-common.h # Include half-float helpers. LIB2FUNCS_STATIC_EXTRA = $(srcdir)/config/arm/fp16.c diff --git a/gcc/config/arm/uclinux-eabi.h b/gcc/config/arm/uclinux-eabi.h index 4455288b88e..c106c980203 100644 --- a/gcc/config/arm/uclinux-eabi.h +++ b/gcc/config/arm/uclinux-eabi.h @@ -64,3 +64,4 @@ : "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); \ } +#define ARM_TARGET2_DWARF_FORMAT DW_EH_PE_absptr diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index fd72babd2ae..f2ab0b88aa9 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -402,12 +402,19 @@ c6x_output_file_unwind (FILE * f) if (done_cfi_sections) return; - /* Output a .cfi_sections directive if we aren't - already doing so for debug info. */ - if (write_symbols != DWARF2_DEBUG && write_symbols != VMS_AND_DWARF2_DEBUG - && dwarf2out_do_frame ()) + /* Output a .cfi_sections directive. */ + if (dwarf2out_do_frame ()) { - asm_fprintf (f, "\t.cfi_sections .c6xabi.exidx\n"); + if (flag_unwind_tables || flag_exceptions) + { + if (write_symbols == DWARF2_DEBUG + || write_symbols == VMS_AND_DWARF2_DEBUG) + asm_fprintf (f, "\t.cfi_sections .debug_frame, .c6xabi.exidx\n"); + else + asm_fprintf (f, "\t.cfi_sections .c6xabi.exidx\n"); + } + else + asm_fprintf (f, "\t.cfi_sections .debug_frame\n"); done_cfi_sections = true; } } @@ -5606,6 +5613,18 @@ c6x_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, gcc_unreachable (); } + +/* Target unwind frame info is generated from dwarf CFI directives, so + always output dwarf2 unwind info. */ + +static enum unwind_info_type +c6x_debug_unwind_info (void) +{ + if (flag_unwind_tables || flag_exceptions) + return UI_DWARF2; + + return default_debug_unwind_info (); +} /* Target Structure. */ @@ -5746,6 +5765,13 @@ c6x_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, #undef TARGET_ASM_TTYPE #define TARGET_ASM_TTYPE c6x_output_ttype +/* The C6x ABI follows the ARM EABI exception handling rules. */ +#undef TARGET_ARM_EABI_UNWINDER +#define TARGET_ARM_EABI_UNWINDER true + +#undef TARGET_DEBUG_UNWIND_INFO +#define TARGET_DEBUG_UNWIND_INFO c6x_debug_unwind_info + #undef TARGET_DWARF_REGISTER_SPAN #define TARGET_DWARF_REGISTER_SPAN c6x_dwarf_register_span diff --git a/gcc/config/c6x/c6x.h b/gcc/config/c6x/c6x.h index 9b1b1636b52..240f2f9ffc7 100644 --- a/gcc/config/c6x/c6x.h +++ b/gcc/config/c6x/c6x.h @@ -329,6 +329,7 @@ enum reg_class /* Before the prologue, the return address is in the B3 register. */ #define RETURN_ADDR_REGNO REG_B3 #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNO) +#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (RETURN_ADDR_REGNO) #define RETURN_ADDR_RTX(COUNT, FRAME) c6x_return_addr_rtx (COUNT) @@ -459,8 +460,6 @@ struct GTY(()) machine_function #define TARG_VEC_PERMUTE_COST 1 #endif -/* Exception handling. */ -#define TARGET_EXTRA_CFI_SECTION(unwind) ((unwind) ? ".c6xabi.exidx" : NULL) /* ttype entries (the only interesting data references used) are sb-relative got-indirect (aka .ehtype). */ #define ASM_PREFERRED_EH_DATA_FORMAT(code, data) \ diff --git a/gcc/config/c6x/t-c6x-elf b/gcc/config/c6x/t-c6x-elf index ed286427025..030a39ce18c 100644 --- a/gcc/config/c6x/t-c6x-elf +++ b/gcc/config/c6x/t-c6x-elf @@ -24,6 +24,7 @@ LIB1ASMFUNCS += _strasgi _strasgi_64plus _clzsi2 _clzdi2 _clz LIB1ASMFUNCS += _push_rts _pop_rts _call_stub LIB2FUNCS_EXCLUDE = _cmpdi2 _ucmpdi2 _gcc_bcmp _eprintf _clzsi _clzdi +EXTRA_HEADERS += $(srcdir)/ginclude/unwind-arm-common.h LIB2FUNCS_EXTRA = $(srcdir)/config/c6x/gef.c \ $(srcdir)/config/c6x/gtf.c \ diff --git a/gcc/ginclude/unwind-arm-common.h b/gcc/ginclude/unwind-arm-common.h new file mode 100644 index 00000000000..95872705e3f --- /dev/null +++ b/gcc/ginclude/unwind-arm-common.h @@ -0,0 +1,251 @@ +/* Header file for the ARM EABI and C6X unwinders + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011 + Free Software Foundation, Inc. + Contributed by Paul Brook + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +/* Language-independent unwinder header public defines. This contains both + ABI defined objects, and GNU support routines. */ + +#ifndef UNWIND_ARM_COMMON_H +#define UNWIND_ARM_COMMON_H + +#define __ARM_EABI_UNWINDER__ 1 + +#ifdef __cplusplus +extern "C" { +#endif + typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); + typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); + typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); + typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); + typedef _Unwind_Word _uw; + typedef unsigned _uw64 __attribute__((mode(__DI__))); + typedef unsigned _uw16 __attribute__((mode(__HI__))); + typedef unsigned _uw8 __attribute__((mode(__QI__))); + + typedef enum + { + _URC_OK = 0, /* operation completed successfully */ + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8, + _URC_FAILURE = 9 /* unspecified failure of some kind */ + } + _Unwind_Reason_Code; + + typedef enum + { + _US_VIRTUAL_UNWIND_FRAME = 0, + _US_UNWIND_FRAME_STARTING = 1, + _US_UNWIND_FRAME_RESUME = 2, + _US_ACTION_MASK = 3, + _US_FORCE_UNWIND = 8, + _US_END_OF_STACK = 16 + } + _Unwind_State; + + /* Provided only for compatibility with existing code. */ + typedef int _Unwind_Action; +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 +#define _UA_END_OF_STACK 16 +#define _URC_NO_REASON _URC_OK + + typedef struct _Unwind_Control_Block _Unwind_Control_Block; + typedef struct _Unwind_Context _Unwind_Context; + typedef _uw _Unwind_EHT_Header; + + + /* UCB: */ + + struct _Unwind_Control_Block + { + char exception_class[8]; + void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *); + /* Unwinder cache, private fields for the unwinder's use */ + struct + { + _uw reserved1; /* Forced unwind stop fn, 0 if not forced */ + _uw reserved2; /* Personality routine address */ + _uw reserved3; /* Saved callsite address */ + _uw reserved4; /* Forced unwind stop arg */ + _uw reserved5; + } + unwinder_cache; + /* Propagation barrier cache (valid after phase 1): */ + struct + { + _uw sp; + _uw bitpattern[5]; + } + barrier_cache; + /* Cleanup cache (preserved over cleanup): */ + struct + { + _uw bitpattern[4]; + } + cleanup_cache; + /* Pr cache (for pr's benefit): */ + struct + { + _uw fnstart; /* function start address */ + _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ + _uw additional; /* additional data */ + _uw reserved1; + } + pr_cache; + long long int :0; /* Force alignment to 8-byte boundary */ + }; + + /* Virtual Register Set*/ + + typedef enum + { + _UVRSC_CORE = 0, /* integer register */ + _UVRSC_VFP = 1, /* vfp */ + _UVRSC_FPA = 2, /* fpa */ + _UVRSC_WMMXD = 3, /* Intel WMMX data register */ + _UVRSC_WMMXC = 4 /* Intel WMMX control register */ + } + _Unwind_VRS_RegClass; + + typedef enum + { + _UVRSD_UINT32 = 0, + _UVRSD_VFPX = 1, + _UVRSD_FPAX = 2, + _UVRSD_UINT64 = 3, + _UVRSD_FLOAT = 4, + _UVRSD_DOUBLE = 5 + } + _Unwind_VRS_DataRepresentation; + + typedef enum + { + _UVRSR_OK = 0, + _UVRSR_NOT_IMPLEMENTED = 1, + _UVRSR_FAILED = 2 + } + _Unwind_VRS_Result; + + /* Frame unwinding state. */ + typedef struct + { + /* The current word (bytes packed msb first). */ + _uw data; + /* Pointer to the next word of data. */ + _uw *next; + /* The number of bytes left in this word. */ + _uw8 bytes_left; + /* The number of words pointed to by ptr. */ + _uw8 words_left; + } + __gnu_unwind_state; + + typedef _Unwind_Reason_Code (*personality_routine) (_Unwind_State, + _Unwind_Control_Block *, _Unwind_Context *); + + _Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation, + void *); + + _Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation, + void *); + + _Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation); + + + /* Support functions for the PR. */ +#define _Unwind_Exception _Unwind_Control_Block + typedef char _Unwind_Exception_Class[8]; + + void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); + _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); + + _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *); + /* This should never be used. */ + _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *); + + /* Interface functions: */ + _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp); + void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp); + _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp); + + typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + _Unwind_Control_Block *, struct _Unwind_Context *, void *); + _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *, + _Unwind_Stop_Fn, void *); + /* @@@ Use unwind data to perform a stack backtrace. The trace callback + is called for every stack frame in the call chain, but no cleanup + actions are performed. */ + typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (_Unwind_Context *, void *); + _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, + void*); + + _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); + void _Unwind_Complete(_Unwind_Control_Block *ucbp); + void _Unwind_DeleteException (_Unwind_Exception *); + + _Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *, + _Unwind_Context *); + _Unwind_Reason_Code __gnu_unwind_execute (_Unwind_Context *, + __gnu_unwind_state *); + + static inline _Unwind_Word + _Unwind_GetGR (_Unwind_Context *context, int regno) + { + _uw val; + _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); + return val; + } + +#define _Unwind_GetIPInfo(context, ip_before_insn) \ + (*ip_before_insn = 0, _Unwind_GetIP (context)) + + static inline void + _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val) + { + _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); + } + + _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); + void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); + +/* leb128 type numbers have a potentially unlimited size. + The target of the following definitions of _sleb128_t and _uleb128_t + is to have efficient data types large enough to hold the leb128 type + numbers used in the unwind code. */ +typedef long _sleb128_t; +typedef unsigned long _uleb128_t; + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* defined UNWIND_ARM_COMMON_H */ |