From a51a7de6f85522bf822d28995b44e385686b844a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 29 Jul 2017 12:38:47 -0700 Subject: libcxxabi: Delete arm EHABI workaound unwind.h in clang 5.0 seems to have needed struct definitions Signed-off-by: Khem Raj --- ...ix-arm-EHABI-code-to-work.-armhf-had-exce.patch | 148 --------------------- recipes-devtools/clang/common.inc | 1 - 2 files changed, 149 deletions(-) delete mode 100644 recipes-devtools/clang/clang/0001-libcxxabi-Fix-arm-EHABI-code-to-work.-armhf-had-exce.patch (limited to 'recipes-devtools') diff --git a/recipes-devtools/clang/clang/0001-libcxxabi-Fix-arm-EHABI-code-to-work.-armhf-had-exce.patch b/recipes-devtools/clang/clang/0001-libcxxabi-Fix-arm-EHABI-code-to-work.-armhf-had-exce.patch deleted file mode 100644 index c2dbe1f..0000000 --- a/recipes-devtools/clang/clang/0001-libcxxabi-Fix-arm-EHABI-code-to-work.-armhf-had-exce.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 6f53040b8810cc2ed5c03cea79e536bbbd032a9e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 21 May 2017 19:18:02 -0700 -Subject: [PATCH] libcxxabi: 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. - -Adapted from Debian - -http://sources.debian.net/src/libc%2B%2B/3.9.1-2/debian/patches/libcxxabi-arm-ehabi-fix.patch/ - -Signed-off-by: Khem Raj ---- - src/cxa_exception.cpp | 23 ++++++++++++++--------- - src/cxa_exception.hpp | 39 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 53 insertions(+), 9 deletions(-) - -diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp -index 0794444..ef78b7e 100644 ---- a/src/cxa_exception.cpp -+++ b/src/cxa_exception.cpp -@@ -219,15 +219,16 @@ __cxa_throw(void *thrown_object, std::type_info *tinfo, void (*dest)(void *)) { - exception_header->unwindHeader.exception_cleanup = exception_cleanup_func; - #ifdef __USING_SJLJ_EXCEPTIONS__ - _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); --#else -+#elif !defined(_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 -@@ -388,11 +389,7 @@ __cxa_begin_catch(void* unwind_arg) throw() - globals->caughtExceptions = exception_header; - } - globals->uncaughtExceptions -= 1; // Not atomically, since globals are thread-local --#if defined(_LIBCXXABI_ARM_EHABI) -- return reinterpret_cast(exception_header->unwindHeader.barrier_cache.bitpattern[0]); --#else -- return exception_header->adjustedPtr; --#endif -+ return __cxa_get_exception_ptr((void*)&exception_header->unwindHeader); - } - // Else this is a foreign exception - // If the caughtExceptions stack is not empty, terminate -@@ -490,7 +487,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 !defined(_LIBCXXABI_ARM_EHABI) - _Unwind_DeleteException(&globals->caughtExceptions->unwindHeader); -+#else -+ _Unwind_DeleteException(globals->caughtExceptions->unwindHeader); -+#endif - globals->caughtExceptions = 0; - } - } -@@ -547,8 +548,10 @@ void __cxa_rethrow() { - } - #ifdef __USING_SJLJ_EXCEPTIONS__ - _Unwind_SjLj_RaiseException(&exception_header->unwindHeader); --#else -+#elif !defined(_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. -@@ -672,8 +675,10 @@ __cxa_rethrow_primary_exception(void* thrown_object) - dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup; - #ifdef __USING_SJLJ_EXCEPTIONS__ - _Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader); -+#elif !defined(_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); -diff --git a/src/cxa_exception.hpp b/src/cxa_exception.hpp -index b9f74e3..fd8a266 100644 ---- a/src/cxa_exception.hpp -+++ b/src/cxa_exception.hpp -@@ -24,6 +24,45 @@ static const uint64_t kOurExceptionClass = 0x434C4E47432B2B00; // CLNGC - static const uint64_t kOurDependentExceptionClass = 0x434C4E47432B2B01; // CLNGC++\1 - static const uint64_t get_vendor_and_language = 0xFFFFFFFFFFFFFF00; // mask for CLNGC++ - -+#if defined(_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. --- -2.13.0 - diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index 2a6600e..faac40d 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc @@ -23,7 +23,6 @@ CLANGPATCHES += "${@'file://0007-clang-Enable-SSP-and-PIE-by-default.patch;patch # libcxxabi patches LIBCXXABIPATCHES ="\ - file://0001-libcxxabi-Fix-arm-EHABI-code-to-work.-armhf-had-exce.patch;patchdir=projects/libcxxabi \ " # libc++ patches -- cgit v1.2.3-54-g00ecf