aboutsummaryrefslogtreecommitdiff
path: root/libunwind
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2023-08-15 11:36:30 -0700
committerSterling Augustine <saugustine@google.com>2023-08-23 14:34:40 -0700
commit5eb44df1b64dbd1a86b099128092a7fd2001c0ba (patch)
tree7e43a77c4db2c9ff5f500a56185aacfcbc04e5cd /libunwind
parent36465e34e8560eda235f2a33f37245ea99dcce01 (diff)
downloadllvm-5eb44df1b64dbd1a86b099128092a7fd2001c0ba.zip
llvm-5eb44df1b64dbd1a86b099128092a7fd2001c0ba.tar.gz
llvm-5eb44df1b64dbd1a86b099128092a7fd2001c0ba.tar.bz2
Make _LIBUNWIND_SUPPORT_FRAME_APIS a build-time option
Previously this was based on target architecture, but that makes very little sense--frame API availability is generally for libgcc compatibility and that is dependent on runtime needs rather than target architecture. Default this to on, so as not to remove the apis from environments that already have them. The functions this macro protects are stubs for libgcc-compatibility. Today, libunwind as a drop-in replacement for libgcc_eh links on x86, x86_64, and powerpc, but not aarch64, which doesn't really make sense. As there is nothing architecture specific about these, they should be provided everywhere or nowhere. The target-specific protection goes all the way back to the original code contribution in 312fcd0e1cf14482b2ae8eee8234541dcc3bc2c4 from 2013, so the original reason is lost to history, and probably not relevant today. Differential Revision: https://reviews.llvm.org/D158011
Diffstat (limited to 'libunwind')
-rw-r--r--libunwind/CMakeLists.txt6
-rw-r--r--libunwind/src/config.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index bc2a820..84f8ce2 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -51,6 +51,7 @@ option(LIBUNWIND_IS_BAREMETAL "Build libunwind for baremetal targets." OFF)
option(LIBUNWIND_USE_FRAME_HEADER_CACHE "Cache frame headers for unwinding. Requires locking dl_iterate_phdr." OFF)
option(LIBUNWIND_REMEMBER_HEAP_ALLOC "Use heap instead of the stack for .cfi_remember_state." OFF)
option(LIBUNWIND_INSTALL_HEADERS "Install the libunwind headers." ON)
+option(LIBUNWIND_ENABLE_FRAME_APIS "Include libgcc-compatible frame apis." OFF)
set(LIBUNWIND_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Define suffix of library directory name (32/64)")
@@ -250,6 +251,11 @@ if (NOT LIBUNWIND_ENABLE_CROSS_UNWINDING)
add_compile_flags(-D_LIBUNWIND_IS_NATIVE_ONLY)
endif()
+# Include stubs for __register_frame_info_bases and related
+if (LIBUNWIND_ENABLE_FRAME_APIS)
+ add_compile_flags(-D_LIBUNWIND_SUPPORT_FRAME_APIS)
+endif()
+
# Threading-support
if (NOT LIBUNWIND_ENABLE_THREADS)
add_compile_flags(-D_LIBUNWIND_HAS_NO_THREADS)
diff --git a/libunwind/src/config.h b/libunwind/src/config.h
index 6707d59..ef6b8d6 100644
--- a/libunwind/src/config.h
+++ b/libunwind/src/config.h
@@ -108,10 +108,6 @@
#define _LIBUNWIND_BUILD_SJLJ_APIS
#endif
-#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__)
-#define _LIBUNWIND_SUPPORT_FRAME_APIS
-#endif
-
#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
(!defined(__APPLE__) && defined(__arm__)) || defined(__aarch64__) || \
defined(__mips__) || defined(__riscv) || defined(__hexagon__) || \