From ef766a7e7096d37a4c2d83d9f778c95eac9e8564 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 13 Aug 2015 14:21:03 +0000 Subject: [PATCH] Enable zero-cost exceptions on non-Apple arm64 platforms Use the canonical __aarch64__ predefined macro for 64-bit ARM. Apple- specific cases are left as __arm64__. Also add an #error for unsupported architectures to catch this sort of case in the future. Differential Revision: http://reviews.llvm.org/D12005 llvm-svn: 244893 --- libunwind/src/config.h | 3 ++- libunwind/src/libunwind.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libunwind/src/config.h b/libunwind/src/config.h index c9ec087a7ea4..9b246347a851 100644 --- a/libunwind/src/config.h +++ b/libunwind/src/config.h @@ -72,7 +72,8 @@ #define _LIBUNWIND_BUILD_ZERO_COST_APIS (defined(__i386__) || \ defined(__x86_64__) || \ - defined(__arm__)) + defined(__arm__) || \ + defined(__aarch64__)) #define _LIBUNWIND_BUILD_SJLJ_APIS 0 #define _LIBUNWIND_SUPPORT_FRAME_APIS (defined(__i386__) || \ defined(__x86_64__)) diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp index 9a16e4868b32..c408e060729b 100644 --- a/libunwind/src/libunwind.cpp +++ b/libunwind/src/libunwind.cpp @@ -58,12 +58,14 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor, #elif defined(__ppc__) new ((void *)cursor) UnwindCursor( context, LocalAddressSpace::sThisAddressSpace); -#elif defined(__arm64__) +#elif defined(__arm64__) || defined(__aarch64__) new ((void *)cursor) UnwindCursor( context, LocalAddressSpace::sThisAddressSpace); #elif _LIBUNWIND_ARM_EHABI new ((void *)cursor) UnwindCursor( context, LocalAddressSpace::sThisAddressSpace); +#else +#error Architecture not supported #endif AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; co->setInfoBasedOnIPRegister();