summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-07-29 12:38:47 -0700
committerKhem Raj <raj.khem@gmail.com>2017-07-29 12:38:47 -0700
commita51a7de6f85522bf822d28995b44e385686b844a (patch)
treec6a9ff8cef708f1b1a94d1971b298edfbf2b264e
parentebf65eba343ae4c5e9af073b62d386d1749c12e0 (diff)
downloadmeta-clang-a51a7de6f85522bf822d28995b44e385686b844a.tar.gz
libcxxabi: Delete arm EHABI workaound
unwind.h in clang 5.0 seems to have needed struct definitions Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--recipes-devtools/clang/clang/0001-libcxxabi-Fix-arm-EHABI-code-to-work.-armhf-had-exce.patch148
-rw-r--r--recipes-devtools/clang/common.inc1
2 files changed, 0 insertions, 149 deletions
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 @@
1From 6f53040b8810cc2ed5c03cea79e536bbbd032a9e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 21 May 2017 19:18:02 -0700
4Subject: [PATCH] libcxxabi: Fix arm EHABI code to work. armhf had exception
5 test failing without EHABI support
6
7No known upstream bug about this. Actual code change is more like workaround than
8something that upstream would accept. Proper fix would be adding _Unwind_Control_Block
9to clang unwind.h. _Unwind_Control_Block should also extend _Unwind_Exception to make
10sure their ABI stays in sync.
11
12No known upstream bug about this.
13
14Adapted from Debian
15
16http://sources.debian.net/src/libc%2B%2B/3.9.1-2/debian/patches/libcxxabi-arm-ehabi-fix.patch/
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 src/cxa_exception.cpp | 23 ++++++++++++++---------
21 src/cxa_exception.hpp | 39 +++++++++++++++++++++++++++++++++++++++
22 2 files changed, 53 insertions(+), 9 deletions(-)
23
24diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
25index 0794444..ef78b7e 100644
26--- a/src/cxa_exception.cpp
27+++ b/src/cxa_exception.cpp
28@@ -219,15 +219,16 @@ __cxa_throw(void *thrown_object, std::type_info *tinfo, void (*dest)(void *)) {
29 exception_header->unwindHeader.exception_cleanup = exception_cleanup_func;
30 #ifdef __USING_SJLJ_EXCEPTIONS__
31 _Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
32-#else
33+#elif !defined(_LIBCXXABI_ARM_EHABI)
34 _Unwind_RaiseException(&exception_header->unwindHeader);
35+#else
36+ _Unwind_RaiseException(exception_header->unwindHeader);
37 #endif
38 // This only happens when there is no handler, or some unexpected unwinding
39 // error happens.
40 failed_throw(exception_header);
41 }
42
43-
44 // 2.5.3 Exception Handlers
45 /*
46 The adjusted pointer is computed by the personality routine during phase 1
47@@ -388,11 +389,7 @@ __cxa_begin_catch(void* unwind_arg) throw()
48 globals->caughtExceptions = exception_header;
49 }
50 globals->uncaughtExceptions -= 1; // Not atomically, since globals are thread-local
51-#if defined(_LIBCXXABI_ARM_EHABI)
52- return reinterpret_cast<void*>(exception_header->unwindHeader.barrier_cache.bitpattern[0]);
53-#else
54- return exception_header->adjustedPtr;
55-#endif
56+ return __cxa_get_exception_ptr((void*)&exception_header->unwindHeader);
57 }
58 // Else this is a foreign exception
59 // If the caughtExceptions stack is not empty, terminate
60@@ -490,7 +487,11 @@ void __cxa_end_catch() {
61 // to touch a foreign exception in any way, that is undefined
62 // behavior. They likely can't since the only way to catch
63 // a foreign exception is with catch (...)!
64+#if !defined(_LIBCXXABI_ARM_EHABI)
65 _Unwind_DeleteException(&globals->caughtExceptions->unwindHeader);
66+#else
67+ _Unwind_DeleteException(globals->caughtExceptions->unwindHeader);
68+#endif
69 globals->caughtExceptions = 0;
70 }
71 }
72@@ -547,8 +548,10 @@ void __cxa_rethrow() {
73 }
74 #ifdef __USING_SJLJ_EXCEPTIONS__
75 _Unwind_SjLj_RaiseException(&exception_header->unwindHeader);
76-#else
77+#elif !defined(_LIBCXXABI_ARM_EHABI)
78 _Unwind_RaiseException(&exception_header->unwindHeader);
79+#else
80+ _Unwind_RaiseException(exception_header->unwindHeader);
81 #endif
82
83 // If we get here, some kind of unwinding error has occurred.
84@@ -672,8 +675,10 @@ __cxa_rethrow_primary_exception(void* thrown_object)
85 dep_exception_header->unwindHeader.exception_cleanup = dependent_exception_cleanup;
86 #ifdef __USING_SJLJ_EXCEPTIONS__
87 _Unwind_SjLj_RaiseException(&dep_exception_header->unwindHeader);
88+#elif !defined(_LIBCXXABI_ARM_EHABI)
89+ _Unwind_RaiseException(&dep_exception_header->unwindHeader);
90 #else
91- _Unwind_RaiseException(&dep_exception_header->unwindHeader);
92+ _Unwind_RaiseException(dep_exception_header->unwindHeader);
93 #endif
94 // Some sort of unwinding error. Note that terminate is a handler.
95 __cxa_begin_catch(&dep_exception_header->unwindHeader);
96diff --git a/src/cxa_exception.hpp b/src/cxa_exception.hpp
97index b9f74e3..fd8a266 100644
98--- a/src/cxa_exception.hpp
99+++ b/src/cxa_exception.hpp
100@@ -24,6 +24,45 @@ static const uint64_t kOurExceptionClass = 0x434C4E47432B2B00; // CLNGC
101 static const uint64_t kOurDependentExceptionClass = 0x434C4E47432B2B01; // CLNGC++\1
102 static const uint64_t get_vendor_and_language = 0xFFFFFFFFFFFFFF00; // mask for CLNGC++
103
104+#if defined(_LIBCXXABI_ARM_EHABI)
105+// GCC has _Unwind_Control_Block in unwind.h (unwind_arm_common.h)
106+#if defined(__clang__)
107+struct _Unwind_Control_Block
108+{
109+ uint64_t exception_class;
110+ void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
111+ struct {
112+ _Unwind_Word reserved1;
113+ _Unwind_Word reserved2;
114+ _Unwind_Word reserved3;
115+ _Unwind_Word reserved4;
116+ _Unwind_Word reserved5;
117+ } unwinder_cache;
118+ struct {
119+ _Unwind_Word sp;
120+ _Unwind_Word bitpattern[5];
121+ } barrier_cache;
122+ struct {
123+ _Unwind_Word bitpattern[4];
124+ } cleanup_cache;
125+ struct {
126+ _Unwind_Word fnstart;
127+ _Unwind_Word *ehtp;
128+ _Unwind_Word additional;
129+ _Unwind_Word reserved1;
130+ } pr_cache;
131+ long long int :0;
132+ operator _Unwind_Exception*() noexcept
133+ {
134+ return reinterpret_cast<_Unwind_Exception*>(this);
135+ }
136+};
137+
138+#endif
139+
140+#define _Unwind_Exception _Unwind_Control_Block
141+#endif
142+
143 struct _LIBCXXABI_HIDDEN __cxa_exception {
144 #if defined(__LP64__) || defined(_LIBCXXABI_ARM_EHABI)
145 // This is a new field to support C++ 0x exception_ptr.
146--
1472.13.0
148
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
23 23
24# libcxxabi patches 24# libcxxabi patches
25LIBCXXABIPATCHES ="\ 25LIBCXXABIPATCHES ="\
26 file://0001-libcxxabi-Fix-arm-EHABI-code-to-work.-armhf-had-exce.patch;patchdir=projects/libcxxabi \
27" 26"
28 27
29# libc++ patches 28# libc++ patches