Commit a0f724db authored by Sylvestre Ledru's avatar Sylvestre Ledru

remove dupes

parent d739e317
Fix arm EHABI code to work. armhf had exception test failing without EHABI support.
No known upstream bug about this. Actual code change is more like workaround than
something that upstream would accept. Proper fix would be adding _Unwind_Control_Block
to clang unwind.h. _Unwind_Control_Block should also extend _Unwind_Exception to make
sure their ABI stays in sync.
No known upstream bug about this.
Index: llvm-toolchain-snapshot_7svn337372/libcxxabi/src/cxa_exception.cpp
===================================================================
--- llvm-toolchain-snapshot_7svn337372.orig/libcxxabi/src/cxa_exception.cpp
+++ llvm-toolchain-snapshot_7svn337372/libcxxabi/src/cxa_exception.cpp
@@ -261,15 +261,16 @@ __cxa_throw(void *thrown_object, std::ty
#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
-#else
+#elif !LIBCXXABI_ARM_EHABI
_Unwind_RaiseException(&exception_header->unwindHeader);
+#else
+ _Unwind_RaiseException(exception_header->unwindHeader);
#endif
// This only happens when there is no handler, or some unexpected unwinding
// error happens.
failed_throw(exception_header);
}
-
// 2.5.3 Exception Handlers
/*
The adjusted pointer is computed by the personality routine during phase 1
@@ -532,7 +533,11 @@ void __cxa_end_catch() {
// to touch a foreign exception in any way, that is undefined
// behavior. They likely can't since the only way to catch
// a foreign exception is with catch (...)!
+#if !LIBCXXABI_ARM_EHABI
_Unwind_DeleteException(&globals->caughtExceptions->unwindHeader);
+#else
+ _Unwind_DeleteException(globals->caughtExceptions->unwindHeader);
+#endif
globals->caughtExceptions = 0;
}
}
@@ -589,8 +594,10 @@ void __cxa_rethrow() {
}
#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
-#else
+#elif !LIBCXXABI_ARM_EHABI
_Unwind_RaiseException(&exception_header->unwindHeader);
+#else
+ _Unwind_RaiseException(exception_header->unwindHeader);
#endif
// If we get here, some kind of unwinding error has occurred.
@@ -714,8 +721,10 @@ __cxa_rethrow_primary_exception(void* th
dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup;
#ifdef __USING_SJLJ_EXCEPTIONS__
_Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader);
+#elif !LIBCXXABI_ARM_EHABI
+ _Unwind_RaiseException(&dep_exception_header->unwindHeader);
#else
- _Unwind_RaiseException(&dep_exception_header->unwindHeader);
+ _Unwind_RaiseException(dep_exception_header->unwindHeader);
#endif
// Some sort of unwinding error. Note that terminate is a handler.
__cxa_begin_catch(&dep_exception_header->unwindHeader);
Index: llvm-toolchain-snapshot_7svn337372/libcxxabi/src/cxa_exception.hpp
===================================================================
--- llvm-toolchain-snapshot_7svn337372.orig/libcxxabi/src/cxa_exception.hpp
+++ llvm-toolchain-snapshot_7svn337372/libcxxabi/src/cxa_exception.hpp
@@ -24,6 +24,45 @@ static const uint64_t kOurExceptionClass
static const uint64_t kOurDependentExceptionClass = 0x434C4E47432B2B01; // CLNGC++\1
static const uint64_t get_vendor_and_language = 0xFFFFFFFFFFFFFF00; // mask for CLNGC++
+#if LIBCXXABI_ARM_EHABI
+// GCC has _Unwind_Control_Block in unwind.h (unwind_arm_common.h)
+#if defined(__clang__)
+struct _Unwind_Control_Block
+{
+ uint64_t exception_class;
+ void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
+ struct {
+ _Unwind_Word reserved1;
+ _Unwind_Word reserved2;
+ _Unwind_Word reserved3;
+ _Unwind_Word reserved4;
+ _Unwind_Word reserved5;
+ } unwinder_cache;
+ struct {
+ _Unwind_Word sp;
+ _Unwind_Word bitpattern[5];
+ } barrier_cache;
+ struct {
+ _Unwind_Word bitpattern[4];
+ } cleanup_cache;
+ struct {
+ _Unwind_Word fnstart;
+ _Unwind_Word *ehtp;
+ _Unwind_Word additional;
+ _Unwind_Word reserved1;
+ } pr_cache;
+ long long int :0;
+ operator _Unwind_Exception*() noexcept
+ {
+ return reinterpret_cast<_Unwind_Exception*>(this);
+ }
+};
+
+#endif
+
+#define _Unwind_Exception _Unwind_Control_Block
+#endif
+
struct _LIBCXXABI_HIDDEN __cxa_exception {
#if defined(__LP64__) || defined(_LIBCXXABI_ARM_EHABI)
// This is a new field to support C++ 0x exception_ptr.
Powerpc has extended double that doesn't match x86 coding. Power format would
need special tests to verify correctness but for now it is enough to prevent
incorrect test from running.
Index: llvm-toolchain-snapshot_7~svn337372/libcxxabi/test/test_demangle.pass.cpp
===================================================================
--- llvm-toolchain-snapshot_7~svn337372.orig/libcxxabi/test/test_demangle.pass.cpp
+++ llvm-toolchain-snapshot_7~svn337372svn337372/libcxxabi/test/test_demangle.pass.cpp
@@ -29648,7 +29648,7 @@ const char* invalid_cases[] =
"NSoERj5E=Y1[uM:ga",
"Aon_PmKVPDk7?fg4XP5smMUL6;<WsI_mgbf23cCgsHbT<l8EE\0uVRkNOoXDrgdA4[8IU>Vl<>IL8ayHpiVDDDXTY;^o9;i",
"_ZNSt16allocator_traitsISaIN4llvm3sys2fs18directory_iteratorEEE9constructIS3_IS3_EEEDTcl12_S_constructfp_fp0_spcl7forwardIT0_Efp1_EEERS4_PT_DpOS7_",
-#if !LDBL_FP80
+#if !LDBL_FP80 && __LDBL_MANT_DIG__ < 64
"_ZN5test01hIfEEvRAcvjplstT_Le4001a000000000000000E_c",
#endif
// The following test cases were found by libFuzzer+ASAN
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment