Index: head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c =================================================================== --- head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c (revision 354346) +++ head/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c (revision 354347) @@ -1,234 +1,249 @@ //===-- gcc_personality_v0.c - Implement __gcc_personality_v0 -------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "int_lib.h" #include +/* + * XXX On FreeBSD, this file is compiled into three libraries: + * - libcompiler_rt + * - libgcc_eh + * - libgcc_s + * + * In the former, the include path points to the contrib/libcxxrt/unwind-arm.h + * copy of unwind.h. In the latter, the include path points to the + * contrib/libunwind/include/unwind.h header (LLVM libunwind). + * + * Neither (seemingly redundant) variant of unwind.h needs the redefinitions + * provided in the "helpful" header below, and libcxxrt's unwind-arm.h provides + * *no* useful distinguishing macros, so just forcibly disable the helper + * header on FreeBSD. + */ #if defined(__arm__) && !defined(__ARM_DWARF_EH__) && \ - !defined(__USING_SJLJ_EXCEPTIONS__) + !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__FreeBSD__) // When building with older compilers (e.g. clang <3.9), it is possible that we // have a version of unwind.h which does not provide the EHABI declarations // which are quired for the C personality to conform to the specification. In // order to provide forward compatibility for such compilers, we re-declare the // necessary interfaces in the helper to permit a standalone compilation of the // builtins (which contains the C unwinding personality for historical reasons). #include "unwind-ehabi-helpers.h" #endif // Pointer encodings documented at: // http://refspecs.freestandards.org/LSB_1.3.0/gLSB/gLSB/ehframehdr.html #define DW_EH_PE_omit 0xff // no data follows #define DW_EH_PE_absptr 0x00 #define DW_EH_PE_uleb128 0x01 #define DW_EH_PE_udata2 0x02 #define DW_EH_PE_udata4 0x03 #define DW_EH_PE_udata8 0x04 #define DW_EH_PE_sleb128 0x09 #define DW_EH_PE_sdata2 0x0A #define DW_EH_PE_sdata4 0x0B #define DW_EH_PE_sdata8 0x0C #define DW_EH_PE_pcrel 0x10 #define DW_EH_PE_textrel 0x20 #define DW_EH_PE_datarel 0x30 #define DW_EH_PE_funcrel 0x40 #define DW_EH_PE_aligned 0x50 #define DW_EH_PE_indirect 0x80 // gcc extension // read a uleb128 encoded value and advance pointer static uintptr_t readULEB128(const uint8_t **data) { uintptr_t result = 0; uintptr_t shift = 0; unsigned char byte; const uint8_t *p = *data; do { byte = *p++; result |= (byte & 0x7f) << shift; shift += 7; } while (byte & 0x80); *data = p; return result; } // read a pointer encoded value and advance pointer static uintptr_t readEncodedPointer(const uint8_t **data, uint8_t encoding) { const uint8_t *p = *data; uintptr_t result = 0; if (encoding == DW_EH_PE_omit) return 0; // first get value switch (encoding & 0x0F) { case DW_EH_PE_absptr: result = *((const uintptr_t *)p); p += sizeof(uintptr_t); break; case DW_EH_PE_uleb128: result = readULEB128(&p); break; case DW_EH_PE_udata2: result = *((const uint16_t *)p); p += sizeof(uint16_t); break; case DW_EH_PE_udata4: result = *((const uint32_t *)p); p += sizeof(uint32_t); break; case DW_EH_PE_udata8: result = *((const uint64_t *)p); p += sizeof(uint64_t); break; case DW_EH_PE_sdata2: result = *((const int16_t *)p); p += sizeof(int16_t); break; case DW_EH_PE_sdata4: result = *((const int32_t *)p); p += sizeof(int32_t); break; case DW_EH_PE_sdata8: result = *((const int64_t *)p); p += sizeof(int64_t); break; case DW_EH_PE_sleb128: default: // not supported compilerrt_abort(); break; } // then add relative offset switch (encoding & 0x70) { case DW_EH_PE_absptr: // do nothing break; case DW_EH_PE_pcrel: result += (uintptr_t)(*data); break; case DW_EH_PE_textrel: case DW_EH_PE_datarel: case DW_EH_PE_funcrel: case DW_EH_PE_aligned: default: // not supported compilerrt_abort(); break; } // then apply indirection if (encoding & DW_EH_PE_indirect) { result = *((const uintptr_t *)result); } *data = p; return result; } #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ !defined(__ARM_DWARF_EH__) #define USING_ARM_EHABI 1 _Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception *, struct _Unwind_Context *); #endif static inline _Unwind_Reason_Code continueUnwind(struct _Unwind_Exception *exceptionObject, struct _Unwind_Context *context) { #if USING_ARM_EHABI // On ARM EHABI the personality routine is responsible for actually // unwinding a single stack frame before returning (ARM EHABI Sec. 6.1). if (__gnu_unwind_frame(exceptionObject, context) != _URC_OK) return _URC_FAILURE; #endif return _URC_CONTINUE_UNWIND; } // The C compiler makes references to __gcc_personality_v0 in // the dwarf unwind information for translation units that use // __attribute__((cleanup(xx))) on local variables. // This personality routine is called by the system unwinder // on each frame as the stack is unwound during a C++ exception // throw through a C function compiled with -fexceptions. #if __USING_SJLJ_EXCEPTIONS__ // the setjump-longjump based exceptions personality routine has a // different name COMPILER_RT_ABI _Unwind_Reason_Code __gcc_personality_sj0( int version, _Unwind_Action actions, uint64_t exceptionClass, struct _Unwind_Exception *exceptionObject, struct _Unwind_Context *context) #elif USING_ARM_EHABI // The ARM EHABI personality routine has a different signature. COMPILER_RT_ABI _Unwind_Reason_Code __gcc_personality_v0( _Unwind_State state, struct _Unwind_Exception *exceptionObject, struct _Unwind_Context *context) #else COMPILER_RT_ABI _Unwind_Reason_Code __gcc_personality_v0( int version, _Unwind_Action actions, uint64_t exceptionClass, struct _Unwind_Exception *exceptionObject, struct _Unwind_Context *context) #endif { // Since C does not have catch clauses, there is nothing to do during // phase 1 (the search phase). #if USING_ARM_EHABI // After resuming from a cleanup we should also continue on to the next // frame straight away. if ((state & _US_ACTION_MASK) != _US_UNWIND_FRAME_STARTING) #else if (actions & _UA_SEARCH_PHASE) #endif return continueUnwind(exceptionObject, context); // There is nothing to do if there is no LSDA for this frame. const uint8_t *lsda = (uint8_t *)_Unwind_GetLanguageSpecificData(context); if (lsda == (uint8_t *)0) return continueUnwind(exceptionObject, context); uintptr_t pc = (uintptr_t)_Unwind_GetIP(context) - 1; uintptr_t funcStart = (uintptr_t)_Unwind_GetRegionStart(context); uintptr_t pcOffset = pc - funcStart; // Parse LSDA header. uint8_t lpStartEncoding = *lsda++; if (lpStartEncoding != DW_EH_PE_omit) { readEncodedPointer(&lsda, lpStartEncoding); } uint8_t ttypeEncoding = *lsda++; if (ttypeEncoding != DW_EH_PE_omit) { readULEB128(&lsda); } // Walk call-site table looking for range that includes current PC. uint8_t callSiteEncoding = *lsda++; uint32_t callSiteTableLength = readULEB128(&lsda); const uint8_t *callSiteTableStart = lsda; const uint8_t *callSiteTableEnd = callSiteTableStart + callSiteTableLength; const uint8_t *p = callSiteTableStart; while (p < callSiteTableEnd) { uintptr_t start = readEncodedPointer(&p, callSiteEncoding); uintptr_t length = readEncodedPointer(&p, callSiteEncoding); uintptr_t landingPad = readEncodedPointer(&p, callSiteEncoding); readULEB128(&p); // action value not used for C code if (landingPad == 0) continue; // no landing pad for this entry if ((start <= pcOffset) && (pcOffset < (start + length))) { // Found landing pad for the PC. // Set Instruction Pointer to so we re-enter function // at landing pad. The landing pad is created by the compiler // to take two parameters in registers. _Unwind_SetGR(context, __builtin_eh_return_data_regno(0), (uintptr_t)exceptionObject); _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), 0); _Unwind_SetIP(context, (funcStart + landingPad)); return _URC_INSTALL_CONTEXT; } } // No landing pad found, continue unwinding. return continueUnwind(exceptionObject, context); } Index: head/contrib/libunwind/include/unwind.h =================================================================== --- head/contrib/libunwind/include/unwind.h (revision 354346) +++ head/contrib/libunwind/include/unwind.h (revision 354347) @@ -1,400 +1,404 @@ //===------------------------------- unwind.h -----------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // // C++ ABI Level 1 ABI documented at: // https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html // //===----------------------------------------------------------------------===// #ifndef __UNWIND_H__ #define __UNWIND_H__ #include <__libunwind_config.h> #include #include #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) && defined(_WIN32) #include #include #endif #if defined(__APPLE__) #define LIBUNWIND_UNAVAIL __attribute__ (( unavailable )) #else #define LIBUNWIND_UNAVAIL #endif typedef enum { _URC_NO_REASON = 0, _URC_OK = 0, _URC_FOREIGN_EXCEPTION_CAUGHT = 1, _URC_FATAL_PHASE2_ERROR = 2, _URC_FATAL_PHASE1_ERROR = 3, _URC_NORMAL_STOP = 4, _URC_END_OF_STACK = 5, _URC_HANDLER_FOUND = 6, _URC_INSTALL_CONTEXT = 7, _URC_CONTINUE_UNWIND = 8, #if defined(_LIBUNWIND_ARM_EHABI) _URC_FAILURE = 9 #endif } _Unwind_Reason_Code; typedef enum { _UA_SEARCH_PHASE = 1, _UA_CLEANUP_PHASE = 2, _UA_HANDLER_FRAME = 4, _UA_FORCE_UNWIND = 8, _UA_END_OF_STACK = 16 // gcc extension to C++ ABI } _Unwind_Action; typedef struct _Unwind_Context _Unwind_Context; // opaque #if defined(_LIBUNWIND_ARM_EHABI) typedef uint32_t _Unwind_State; static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0; static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1; static const _Unwind_State _US_UNWIND_FRAME_RESUME = 2; static const _Unwind_State _US_ACTION_MASK = 3; /* Undocumented flag for force unwinding. */ static const _Unwind_State _US_FORCE_UNWIND = 8; typedef uint32_t _Unwind_EHT_Header; +/* + * gcc_personality_v0 references 'struct _Unwind_Exception' all over the place. + * Nothing in libunwind cares about 'struct _Unwind_Control_Block,' so make it + * the alias of struct _Unwind_Exception, instead of the other way around. + */ +struct _Unwind_Exception; +typedef struct _Unwind_Exception _Unwind_Exception; +typedef struct _Unwind_Exception _Unwind_Control_Block; /* Alias */ -struct _Unwind_Control_Block; -typedef struct _Unwind_Control_Block _Unwind_Control_Block; -typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */ - -struct _Unwind_Control_Block { +struct _Unwind_Exception { uint64_t exception_class; void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block*); /* Unwinder cache, private fields for the unwinder's use */ struct { uint32_t reserved1; /* init reserved1 to 0, then don't touch */ uint32_t reserved2; uint32_t reserved3; uint32_t reserved4; uint32_t reserved5; } unwinder_cache; /* Propagation barrier cache (valid after phase 1): */ struct { uint32_t sp; uint32_t bitpattern[5]; } barrier_cache; /* Cleanup cache (preserved over cleanup): */ struct { uint32_t bitpattern[4]; } cleanup_cache; /* Pr cache (for pr's benefit): */ struct { uint32_t fnstart; /* function start address */ _Unwind_EHT_Header* ehtp; /* pointer to EHT entry header word */ uint32_t additional; uint32_t reserved1; } pr_cache; long long int :0; /* Enforce the 8-byte alignment */ } __attribute__((__aligned__(8))); typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (_Unwind_State state, _Unwind_Exception* exceptionObject, struct _Unwind_Context* context); typedef _Unwind_Reason_Code (*__personality_routine) (_Unwind_State state, _Unwind_Exception* exceptionObject, struct _Unwind_Context* context); #else struct _Unwind_Context; // opaque struct _Unwind_Exception; // forward declaration typedef struct _Unwind_Exception _Unwind_Exception; struct _Unwind_Exception { uint64_t exception_class; void (*exception_cleanup)(_Unwind_Reason_Code reason, _Unwind_Exception *exc); #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) uintptr_t private_[6]; #else uintptr_t private_1; // non-zero means forced unwind uintptr_t private_2; // holds sp that phase1 found for phase2 to use #endif #if __SIZEOF_POINTER__ == 4 // The implementation of _Unwind_Exception uses an attribute mode on the // above fields which has the side effect of causing this whole struct to // round up to 32 bytes in size (48 with SEH). To be more explicit, we add // pad fields added for binary compatibility. uint32_t reserved[3]; #endif // The Itanium ABI requires that _Unwind_Exception objects are "double-word // aligned". GCC has interpreted this to mean "use the maximum useful // alignment for the target"; so do we. } __attribute__((__aligned__)); typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int version, _Unwind_Action actions, uint64_t exceptionClass, _Unwind_Exception* exceptionObject, struct _Unwind_Context* context, void* stop_parameter ); typedef _Unwind_Reason_Code (*__personality_routine) (int version, _Unwind_Action actions, uint64_t exceptionClass, _Unwind_Exception* exceptionObject, struct _Unwind_Context* context); #endif #ifdef __cplusplus extern "C" { #endif // // The following are the base functions documented by the C++ ABI // #ifdef __USING_SJLJ_EXCEPTIONS__ extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException(_Unwind_Exception *exception_object); extern void _Unwind_SjLj_Resume(_Unwind_Exception *exception_object); #else extern _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception *exception_object); extern void _Unwind_Resume(_Unwind_Exception *exception_object); #endif extern void _Unwind_DeleteException(_Unwind_Exception *exception_object); #if defined(_LIBUNWIND_ARM_EHABI) typedef enum { _UVRSC_CORE = 0, /* integer register */ _UVRSC_VFP = 1, /* vfp */ _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_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; extern void _Unwind_Complete(_Unwind_Exception* exception_object); extern _Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *context, _Unwind_VRS_RegClass regclass, uint32_t regno, _Unwind_VRS_DataRepresentation representation, void *valuep); extern _Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_RegClass regclass, uint32_t regno, _Unwind_VRS_DataRepresentation representation, void *valuep); extern _Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass, uint32_t discriminator, _Unwind_VRS_DataRepresentation representation); #endif #if !defined(_LIBUNWIND_ARM_EHABI) extern uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index); extern void _Unwind_SetGR(struct _Unwind_Context *context, int index, uintptr_t new_value); extern uintptr_t _Unwind_GetIP(struct _Unwind_Context *context); extern void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t new_value); #else // defined(_LIBUNWIND_ARM_EHABI) #if defined(_LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE) #define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 extern #else #define _LIBUNWIND_EXPORT_UNWIND_LEVEL1 static __inline__ #endif // These are de facto helper functions for ARM, which delegate the function // calls to _Unwind_VRS_Get/Set(). These are not a part of ARM EHABI // specification, thus these function MUST be inlined. Please don't replace // these with the "extern" function declaration; otherwise, the program // including this header won't be ABI compatible and will result in // link error when we are linking the program with libgcc. _LIBUNWIND_EXPORT_UNWIND_LEVEL1 uintptr_t _Unwind_GetGR(struct _Unwind_Context *context, int index) { uintptr_t value = 0; _Unwind_VRS_Get(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value); return value; } _LIBUNWIND_EXPORT_UNWIND_LEVEL1 void _Unwind_SetGR(struct _Unwind_Context *context, int index, uintptr_t value) { _Unwind_VRS_Set(context, _UVRSC_CORE, (uint32_t)index, _UVRSD_UINT32, &value); } _LIBUNWIND_EXPORT_UNWIND_LEVEL1 uintptr_t _Unwind_GetIP(struct _Unwind_Context *context) { // remove the thumb-bit before returning return _Unwind_GetGR(context, 15) & (~(uintptr_t)0x1); } _LIBUNWIND_EXPORT_UNWIND_LEVEL1 void _Unwind_SetIP(struct _Unwind_Context *context, uintptr_t value) { uintptr_t thumb_bit = _Unwind_GetGR(context, 15) & ((uintptr_t)0x1); _Unwind_SetGR(context, 15, value | thumb_bit); } #endif // defined(_LIBUNWIND_ARM_EHABI) extern uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *context); extern uintptr_t _Unwind_GetLanguageSpecificData(struct _Unwind_Context *context); #ifdef __USING_SJLJ_EXCEPTIONS__ extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(_Unwind_Exception *exception_object, _Unwind_Stop_Fn stop, void *stop_parameter); #else extern _Unwind_Reason_Code _Unwind_ForcedUnwind(_Unwind_Exception *exception_object, _Unwind_Stop_Fn stop, void *stop_parameter); #endif #ifdef __USING_SJLJ_EXCEPTIONS__ typedef struct _Unwind_FunctionContext *_Unwind_FunctionContext_t; extern void _Unwind_SjLj_Register(_Unwind_FunctionContext_t fc); extern void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t fc); #endif // // The following are semi-suppoted extensions to the C++ ABI // // // called by __cxa_rethrow(). // #ifdef __USING_SJLJ_EXCEPTIONS__ extern _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(_Unwind_Exception *exception_object); #else extern _Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object); #endif // _Unwind_Backtrace() is a gcc extension that walks the stack and calls the // _Unwind_Trace_Fn once per frame until it reaches the bottom of the stack // or the _Unwind_Trace_Fn function returns something other than _URC_NO_REASON. typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *, void *); extern _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *); // _Unwind_GetCFA is a gcc extension that can be called from within a // personality handler to get the CFA (stack pointer before call) of // current frame. extern uintptr_t _Unwind_GetCFA(struct _Unwind_Context *); // _Unwind_GetIPInfo is a gcc extension that can be called from within a // personality handler. Similar to _Unwind_GetIP() but also returns in // *ipBefore a non-zero value if the instruction pointer is at or before the // instruction causing the unwind. Normally, in a function call, the IP returned // is the return address which is after the call instruction and may be past the // end of the function containing the call instruction. extern uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *context, int *ipBefore); // __register_frame() is used with dynamically generated code to register the // FDE for a generated (JIT) code. The FDE must use pc-rel addressing to point // to its function and optional LSDA. // __register_frame() has existed in all versions of Mac OS X, but in 10.4 and // 10.5 it was buggy and did not actually register the FDE with the unwinder. // In 10.6 and later it does register properly. extern void __register_frame(const void *fde); extern void __deregister_frame(const void *fde); // _Unwind_Find_FDE() will locate the FDE if the pc is in some function that has // an associated FDE. Note, Mac OS X 10.6 and later, introduces "compact unwind // info" which the runtime uses in preference to DWARF unwind info. This // function will only work if the target function has an FDE but no compact // unwind info. struct dwarf_eh_bases { uintptr_t tbase; uintptr_t dbase; uintptr_t func; }; extern const void *_Unwind_Find_FDE(const void *pc, struct dwarf_eh_bases *); // This function attempts to find the start (address of first instruction) of // a function given an address inside the function. It only works if the // function has an FDE (DWARF unwind info). // This function is unimplemented on Mac OS X 10.6 and later. Instead, use // _Unwind_Find_FDE() and look at the dwarf_eh_bases.func result. extern void *_Unwind_FindEnclosingFunction(void *pc); // Mac OS X does not support text-rel and data-rel addressing so these functions // are unimplemented extern uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *context) LIBUNWIND_UNAVAIL; extern uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context *context) LIBUNWIND_UNAVAIL; // Mac OS X 10.4 and 10.5 had implementations of these functions in // libgcc_s.dylib, but they never worked. /// These functions are no longer available on Mac OS X. extern void __register_frame_info_bases(const void *fde, void *ob, void *tb, void *db) LIBUNWIND_UNAVAIL; extern void __register_frame_info(const void *fde, void *ob) LIBUNWIND_UNAVAIL; extern void __register_frame_info_table_bases(const void *fde, void *ob, void *tb, void *db) LIBUNWIND_UNAVAIL; extern void __register_frame_info_table(const void *fde, void *ob) LIBUNWIND_UNAVAIL; extern void __register_frame_table(const void *fde) LIBUNWIND_UNAVAIL; extern void *__deregister_frame_info(const void *fde) LIBUNWIND_UNAVAIL; extern void *__deregister_frame_info_bases(const void *fde) LIBUNWIND_UNAVAIL; #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) #ifndef _WIN32 typedef struct _EXCEPTION_RECORD EXCEPTION_RECORD; typedef struct _CONTEXT CONTEXT; typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT; #elif !defined(__MINGW32__) && VER_PRODUCTBUILD < 8000 typedef struct _DISPATCHER_CONTEXT DISPATCHER_CONTEXT; #endif // This is the common wrapper for GCC-style personality functions with SEH. extern EXCEPTION_DISPOSITION _GCC_specific_handler(EXCEPTION_RECORD *exc, void *frame, CONTEXT *ctx, DISPATCHER_CONTEXT *disp, __personality_routine pers); #endif #ifdef __cplusplus } #endif #endif // __UNWIND_H__ Index: head/lib/libcompiler_rt/Makefile =================================================================== --- head/lib/libcompiler_rt/Makefile (revision 354346) +++ head/lib/libcompiler_rt/Makefile (revision 354347) @@ -1,32 +1,28 @@ # $FreeBSD$ .include PACKAGE= lib${LIB} LIB= compiler_rt NO_PIC= WARNS?= 2 CFLAGS+= ${PICFLAG} CFLAGS+= -fvisibility=hidden CFLAGS+= -DVISIBILITY_HIDDEN CFLAGS+= -I${SRCTOP}/contrib/libcxxrt -.if ${COMPILER_TYPE} == "clang" -CWARNFLAGS.gcc_personality_v0.c+= -Wno-typedef-redefinition -.endif - # gcc has incompatible internal declarations for __divtc3 and __multc3, but has # no option to silence its warning, so make warnings non-fatal. NO_WERROR.gcc= .include "Makefile.inc" .if ${MK_INSTALLLIB} != "no" SYMLINKS+= libcompiler_rt.a ${LIBDIR}/libgcc.a .endif .if ${MK_PROFILE} != "no" SYMLINKS+= libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a .endif .include Index: head/lib/libgcc_s/Version.map =================================================================== --- head/lib/libgcc_s/Version.map (revision 354346) +++ head/lib/libgcc_s/Version.map (nonexistent) @@ -1,154 +0,0 @@ -/* - * $FreeBSD$ - */ - -GCC_3.0 { -global: - __absvdi2; - __absvsi2; - __addvdi3; - __addvsi3; - __ashldi3; - __ashlti3; - __ashrdi3; - __ashrti3; - __clear_cache; - __cmpdi2; - __cmpti2; - __deregister_frame; - __deregister_frame_info; - __deregister_frame_info_bases; - __divdi3; - __divti3; - __ffsdi2; - __ffsti2; - __fixdfdi; - __fixdfti; - __fixsfdi; - __fixsfti; - __fixunsdfdi; - __fixunsdfsi; - __fixunsdfti; - __fixunssfdi; - __fixunssfsi; - __fixunssfti; - __fixunsxfdi; - __fixunsxfsi; - __fixunsxfti; - __fixxfdi; - __fixxfti; - __floatdidf; - __floatdisf; - __floatdixf; - __floattidf; - __floattisf; - __floattixf; - __lshrdi3; - __lshrti3; - __moddi3; - __modti3; - __muldi3; - __multi3; - __mulvdi3; - __mulvsi3; - __negdi2; - __negti2; - __negvdi2; - __negvsi2; - __register_frame; - __register_frame_info; - __register_frame_info_bases; - __register_frame_info_table; - __register_frame_info_table_bases; - __register_frame_table; - __subvdi3; - __subvsi3; - __ucmpdi2; - __ucmpti2; - __udivdi3; - __udivmoddi4; - __udivmodti4; - __udivti3; - __umoddi3; - __umodti3; - _Unwind_DeleteException; - _Unwind_Find_FDE; - _Unwind_ForcedUnwind; - _Unwind_GetDataRelBase; - _Unwind_GetGR; - _Unwind_GetIP; - _Unwind_GetLanguageSpecificData; - _Unwind_GetRegionStart; - _Unwind_GetTextRelBase; - _Unwind_RaiseException; - _Unwind_Resume; - _Unwind_SetGR; - _Unwind_SetIP; -local: - *; -}; - -GCC_3.3 { - _Unwind_Backtrace; - _Unwind_FindEnclosingFunction; - _Unwind_GetCFA; - _Unwind_Resume_or_Rethrow; -} GCC_3.0; - -GCC_3.3.1 { - __gcc_personality_v0; -} GCC_3.3; - -GCC_3.4 { - __clzdi2; - __clzsi2; - __clzti2; - __ctzdi2; - __ctzsi2; - __ctzti2; - __paritydi2; - __paritysi2; - __parityti2; - __popcountdi2; - __popcountsi2; - __popcountti2; -} GCC_3.3.1; - -GCC_3.4.2 { - __enable_execute_stack; -} GCC_3.4; - -GCC_3.4.4 { - __absvti2; - __addvti3; - __mulvti3; - __negvti2; - __subvti3; -} GCC_3.4.2; - -GCC_4.0.0 { - __divdc3; - __divsc3; - __divxc3; - __muldc3; - __mulsc3; - __mulxc3; - __powidf2; - __powisf2; - __powixf2; -} GCC_3.4.4; - -GCC_4.2.0 { - __floatundidf; - __floatundisf; - __floatundixf; - __floatuntidf; - __floatuntisf; - __floatuntixf; - _Unwind_GetIPInfo; -} GCC_4.0.0; - -GCC_4.3.0 { - __bswapdi2; - __bswapsi2; -} GCC_4.2.0; Property changes on: head/lib/libgcc_s/Version.map ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/lib/libgcc_s/Makefile =================================================================== --- head/lib/libgcc_s/Makefile (revision 354346) +++ head/lib/libgcc_s/Makefile (revision 354347) @@ -1,45 +1,55 @@ # $FreeBSD$ PACKAGE= clibs SHLIB_NAME= libgcc_s.so.1 SHLIBDIR?= /lib +.include + MK_SSP= no WARNS?= 2 LDFLAGS+= -nodefaultlibs LIBADD+= c -VERSION_MAP= ${.CURDIR}/Version.map + +.if ${MK_SYMVER} == "yes" +VERSION_DEF= ${.CURDIR}/Versions.def +SYMBOL_MAPS= ${.CURDIR}/Symbol.map +# Export ARM AEABI unwind routines needed by libc and libthr. +.if exists(${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map) +SYMBOL_MAPS+= ${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map +.endif +.endif .include "../libcompiler_rt/Makefile.inc" .include "../libgcc_eh/Makefile.inc" # gcc has incompatible internal declarations for __divtc3 and __multc3, but has # no option to silence its warning, so make warnings non-fatal. NO_WERROR.gcc= LIBCSRCDIR= ${SRCTOP}/lib/libc LIBMSRCDIR= ${SRCTOP}/lib/msun/src CFLAGS+= -I${LIBCSRCDIR}/include -I${LIBCSRCDIR}/${MACHINE_CPUARCH} CFLAGS+= -I${LIBMSRCDIR} .PATH: ${LIBMSRCDIR} SRCS+= s_fabs.c SRCS+= s_fabsf.c SRCS+= s_fabsl.c SRCS+= s_fmax.c SRCS+= s_fmaxf.c SRCS+= s_logb.c SRCS+= s_logbf.c SRCS+= s_scalbn.c SRCS+= s_scalbnf.c # Don't include long double routines on architectures where long double # is the same size as double. .if ${MACHINE_CPUARCH} != "mips" && ${MACHINE_CPUARCH} != "arm" && \ ${MACHINE_CPUARCH} != "powerpc" SRCS+= s_fmaxl.c SRCS+= s_logbl.c SRCS+= s_scalbnl.c .endif .include Index: head/lib/libgcc_s/Symbol.map =================================================================== --- head/lib/libgcc_s/Symbol.map (nonexistent) +++ head/lib/libgcc_s/Symbol.map (revision 354347) @@ -0,0 +1,151 @@ +/* + * $FreeBSD$ + */ + +GCC_3.0 { + __absvdi2; + __absvsi2; + __addvdi3; + __addvsi3; + __ashldi3; + __ashlti3; + __ashrdi3; + __ashrti3; + __clear_cache; + __cmpdi2; + __cmpti2; + __deregister_frame; + __deregister_frame_info; + __deregister_frame_info_bases; + __divdi3; + __divti3; + __ffsdi2; + __ffsti2; + __fixdfdi; + __fixdfti; + __fixsfdi; + __fixsfti; + __fixunsdfdi; + __fixunsdfsi; + __fixunsdfti; + __fixunssfdi; + __fixunssfsi; + __fixunssfti; + __fixunsxfdi; + __fixunsxfsi; + __fixunsxfti; + __fixxfdi; + __fixxfti; + __floatdidf; + __floatdisf; + __floatdixf; + __floattidf; + __floattisf; + __floattixf; + __lshrdi3; + __lshrti3; + __moddi3; + __modti3; + __muldi3; + __multi3; + __mulvdi3; + __mulvsi3; + __negdi2; + __negti2; + __negvdi2; + __negvsi2; + __register_frame; + __register_frame_info; + __register_frame_info_bases; + __register_frame_info_table; + __register_frame_info_table_bases; + __register_frame_table; + __subvdi3; + __subvsi3; + __ucmpdi2; + __ucmpti2; + __udivdi3; + __udivmoddi4; + __udivmodti4; + __udivti3; + __umoddi3; + __umodti3; + _Unwind_DeleteException; + _Unwind_Find_FDE; + _Unwind_ForcedUnwind; + _Unwind_GetDataRelBase; + _Unwind_GetGR; + _Unwind_GetIP; + _Unwind_GetLanguageSpecificData; + _Unwind_GetRegionStart; + _Unwind_GetTextRelBase; + _Unwind_RaiseException; + _Unwind_Resume; + _Unwind_SetGR; + _Unwind_SetIP; +}; + +GCC_3.3 { + _Unwind_Backtrace; + _Unwind_FindEnclosingFunction; + _Unwind_GetCFA; + _Unwind_Resume_or_Rethrow; +}; + +GCC_3.3.1 { + __gcc_personality_v0; +}; + +GCC_3.4 { + __clzdi2; + __clzsi2; + __clzti2; + __ctzdi2; + __ctzsi2; + __ctzti2; + __paritydi2; + __paritysi2; + __parityti2; + __popcountdi2; + __popcountsi2; + __popcountti2; +}; + +GCC_3.4.2 { + __enable_execute_stack; +}; + +GCC_3.4.4 { + __absvti2; + __addvti3; + __mulvti3; + __negvti2; + __subvti3; +}; + +GCC_4.0.0 { + __divdc3; + __divsc3; + __divxc3; + __muldc3; + __mulsc3; + __mulxc3; + __powidf2; + __powisf2; + __powixf2; +}; + +GCC_4.2.0 { + __floatundidf; + __floatundisf; + __floatundixf; + __floatuntidf; + __floatuntisf; + __floatuntixf; + _Unwind_GetIPInfo; +}; + +GCC_4.3.0 { + __bswapdi2; + __bswapsi2; +}; Property changes on: head/lib/libgcc_s/Symbol.map ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/lib/libgcc_s/Versions.def =================================================================== --- head/lib/libgcc_s/Versions.def (nonexistent) +++ head/lib/libgcc_s/Versions.def (revision 354347) @@ -0,0 +1,31 @@ +# $FreeBSD$ + +GCC_3.0 { +}; + +GCC_3.3 { +} GCC_3.0; + +GCC_3.3.1 { +} GCC_3.3; + +GCC_3.4 { +} GCC_3.3.1; + +GCC_3.4.2 { +} GCC_3.4; + +GCC_3.4.4 { +} GCC_3.4.2; + +GCC_3.5 { +} GCC_3.4.4; + +GCC_4.0.0 { +} GCC_3.5; + +GCC_4.2.0 { +} GCC_4.0.0; + +GCC_4.3.0 { +} GCC_4.2.0; Property changes on: head/lib/libgcc_s/Versions.def ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/lib/libgcc_s/arm/Symbol.map =================================================================== --- head/lib/libgcc_s/arm/Symbol.map (nonexistent) +++ head/lib/libgcc_s/arm/Symbol.map (revision 354347) @@ -0,0 +1,12 @@ +/* + * $FreeBSD$ + */ + +GCC_3.5 { + _Unwind_VRS_Get; + _Unwind_VRS_Set; + __aeabi_unwind_cpp_pr0; + __aeabi_unwind_cpp_pr1; + __aeabi_unwind_cpp_pr2; + __gnu_unwind_frame; +}; Property changes on: head/lib/libgcc_s/arm/Symbol.map ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property