[PATCH] D38249: [libunwind] Skip building unused parts when targeting SJLJ

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 12:54:13 PDT 2017


mstorsjo created this revision.
Herald added subscribers: kristof.beyls, aemerson.

When SJLJ exceptions are used, those functions aren't used.

This fixes build failures on ARM with SJLJ enabled, such as armv7/iOS.


https://reviews.llvm.org/D38249

Files:
  src/UnwindLevel1.c
  src/UnwindRegistersRestore.S
  src/UnwindRegistersSave.S
  src/libunwind.cpp


Index: src/libunwind.cpp
===================================================================
--- src/libunwind.cpp
+++ src/libunwind.cpp
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 
 
+#ifndef __USING_SJLJ_EXCEPTIONS__
 #include "AddressSpace.hpp"
 #include "UnwindCursor.hpp"
 
@@ -341,6 +342,7 @@
   DwarfFDECache<LocalAddressSpace>::removeAllIn((LocalAddressSpace::pint_t)fde);
 }
 #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
+#endif // !defined(__USING_SJLJ_EXCEPTIONS__)
 
 
 
Index: src/UnwindRegistersSave.S
===================================================================
--- src/UnwindRegistersSave.S
+++ src/UnwindRegistersSave.S
@@ -289,7 +289,7 @@
   mov    x0, #0                   // return UNW_ESUCCESS
   ret
 
-#elif defined(__arm__) && !defined(__APPLE__)
+#elif defined(__arm__) && !(defined(__APPLE__) || defined(__USING_SJLJ_EXCEPTIONS__))
 
 #if !defined(__ARM_ARCH_ISA_ARM)
   .thumb
Index: src/UnwindRegistersRestore.S
===================================================================
--- src/UnwindRegistersRestore.S
+++ src/UnwindRegistersRestore.S
@@ -308,7 +308,7 @@
   ldp    x0, x1,  [x0, #0x000]  // restore x0,x1
   ret    x30                    // jump to pc
 
-#elif defined(__arm__) && !defined(__APPLE__)
+#elif defined(__arm__) && !(defined(__APPLE__) || defined(__USING_SJLJ_EXCEPTIONS__))
 
 #if !defined(__ARM_ARCH_ISA_ARM)
   .thumb
Index: src/UnwindLevel1.c
===================================================================
--- src/UnwindLevel1.c
+++ src/UnwindLevel1.c
@@ -30,7 +30,7 @@
 #include "unwind.h"
 #include "config.h"
 
-#if !defined(_LIBUNWIND_ARM_EHABI)
+#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__)
 
 static _Unwind_Reason_Code
 unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) {
@@ -503,4 +503,4 @@
   unw_set_reg(cursor, UNW_REG_IP, value);
 }
 
-#endif // !defined(_LIBUNWIND_ARM_EHABI)
+#endif // !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38249.116593.patch
Type: text/x-patch
Size: 2011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170925/a9802748/attachment.bin>


More information about the cfe-commits mailing list