[PATCH] D53127: Fix declaration of _URC_FATAL_PHASE1_ERROR in libc++abi when compiled with gcc (follow-up of D42242)

Steffen Kuhn via Phabricator reviews at reviews.llvm.org
Wed Oct 10 23:52:26 PDT 2018


stefson created this revision.
stefson added reviewers: compnerd, bebuch, EricWF.
Herald added subscribers: libcxx-commits, ldionne.

This is follow-up of https://bugs.llvm.org/show_bug.cgi?id=35945, which reports that libc++ doesn't build for the Raspberry PI.

Errors related to char[8] are fixed now, but there are some missing values from  _Unwind_Reason_Code enum and wrong behavior of  _US_FORCE_UNWIND

this is taken (with permission) from: https://src.fedoraproject.org/rpms/v8/blob/master/f/v8-6.7.17-fix-gcc-unwind-header.patch

Not sure about who should review this, so I added all reviewers from https://reviews.llvm.org/D42242

With https://reviews.llvm.org/D42242 and this patch, libc++abi can be compiled using gcc. The reason this went unnoticed for so long is that allmost all distros use clang to build their libcxx/libcxxabi package, which passed fine.


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D53127

Files:
  src/cxa_exception.hpp
  src/cxa_personality.cpp


Index: src/cxa_personality.cpp
===================================================================
--- src/cxa_personality.cpp
+++ src/cxa_personality.cpp
@@ -1109,7 +1109,7 @@
 
     // Check the undocumented force unwinding behavior
     bool is_force_unwinding = state & _US_FORCE_UNWIND;
-    state &= ~_US_FORCE_UNWIND;
+    state = (_Unwind_State)(state & ~_US_FORCE_UNWIND);
 
     scan_results results;
     switch (state) {
Index: src/cxa_exception.hpp
===================================================================
--- src/cxa_exception.hpp
+++ src/cxa_exception.hpp
@@ -28,6 +28,13 @@
 void     __setExceptionClass  (      _Unwind_Exception*, uint64_t);
 bool     __isOurExceptionClass(const _Unwind_Exception*);
 
+#if defined(__arm__) && defined(__GNUC__)
+// missing values from _Unwind_Reason_Code enum
+#define _URC_FATAL_PHASE2_ERROR ((_Unwind_Reason_Code)2)
+#define _URC_FATAL_PHASE1_ERROR ((_Unwind_Reason_Code)3)
+#define _URC_NORMAL_STOP ((_Unwind_Reason_Code)4)
+#endif
+
 struct _LIBCXXABI_HIDDEN __cxa_exception {
 #if defined(__LP64__) || defined(_LIBCXXABI_ARM_EHABI)
     // This is a new field to support C++ 0x exception_ptr.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53127.169155.patch
Type: text/x-patch
Size: 1161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181011/17f39f93/attachment.bin>


More information about the libcxx-commits mailing list