From b51c49aa5202823f459d52adb9c20131928712a8 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Tue, 26 Sep 2017 08:07:26 +0000 Subject: [PATCH] Skip building unused parts when targeting SJLJ When SJLJ exceptions are used, those functions aren't used. This fixes build failures on ARM with SJLJ enabled (e.g. on armv7/iOS) when built using the CMake project files. Differential Revision: https://reviews.llvm.org/D38249 llvm-svn: 314197 --- libunwind/src/UnwindLevel1.c | 4 ++-- libunwind/src/UnwindRegistersRestore.S | 2 +- libunwind/src/UnwindRegistersSave.S | 2 +- libunwind/src/libunwind.cpp | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c index 19116fa..3a908a5 100644 --- a/libunwind/src/UnwindLevel1.c +++ b/libunwind/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 @@ _LIBUNWIND_EXPORT void _Unwind_SetIP(struct _Unwind_Context *context, unw_set_reg(cursor, UNW_REG_IP, value); } -#endif // !defined(_LIBUNWIND_ARM_EHABI) +#endif // !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) diff --git a/libunwind/src/UnwindRegistersRestore.S b/libunwind/src/UnwindRegistersRestore.S index 408ba03..e629e25 100644 --- a/libunwind/src/UnwindRegistersRestore.S +++ b/libunwind/src/UnwindRegistersRestore.S @@ -308,7 +308,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind15Registers_arm646jumptoEv) 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 diff --git a/libunwind/src/UnwindRegistersSave.S b/libunwind/src/UnwindRegistersSave.S index 4860e8f..a0f864e 100644 --- a/libunwind/src/UnwindRegistersSave.S +++ b/libunwind/src/UnwindRegistersSave.S @@ -289,7 +289,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) 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 diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index f072d55..e9981f4 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -24,6 +24,7 @@ #include +#if !defined(__USING_SJLJ_EXCEPTIONS__) #include "AddressSpace.hpp" #include "UnwindCursor.hpp" @@ -341,6 +342,7 @@ void _unw_remove_dynamic_fde(unw_word_t fde) { DwarfFDECache::removeAllIn((LocalAddressSpace::pint_t)fde); } #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) +#endif // !defined(__USING_SJLJ_EXCEPTIONS__) -- 2.7.4