summaryrefslogtreecommitdiff
path: root/libunwind/CMakeLists.txt
diff options
context:
space:
mode:
authorAsiri Rathnayake <asiri.rathnayake@arm.com>2016-05-25 12:36:34 +0000
committerAsiri Rathnayake <asiri.rathnayake@arm.com>2016-05-25 12:36:34 +0000
commit8673bda560c48d0233fc0837652bda3153d16061 (patch)
treec5d332e1ba51bd786e85f4c970f3575ab61b1637 /libunwind/CMakeLists.txt
parent4f8dc7c6576bb34a1aa75bc471574b06ac1c1be1 (diff)
Introduce a native-only unwinder build.
Currently libunwind is built to support cross-unwinding [1] by default, which requires the buffers unw_context_t and unw_cursor_t to be large enough to hold the vritual register set (VRS) of any supported architecture. This is not desirable for some platforms where the stack usage of the unwinder needs to be kept to a minimum (e.g. bare-metal targets). The current patch introduces a native-only (-DLIBUNWIND_ENABLE_CROSS_UNWINDING=OFF) unwinder variant that adopts strict sizes for the buffers unw_context_t and unw_cursor_t depending on the target architecture. [1] http://www.nongnu.org/libunwind/man/libunwind(3).html#section_4 Change-Id: I380fff9a56c16a0fc520e3b1d8454a34b4a48373
Diffstat (limited to 'libunwind/CMakeLists.txt')
-rw-r--r--libunwind/CMakeLists.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index f45af849aa3..628225b0089 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -103,6 +103,7 @@ option(LIBUNWIND_ENABLE_ASSERTIONS "Enable assertions independent of build mode.
option(LIBUNWIND_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBUNWIND_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBUNWIND_ENABLE_SHARED "Build libunwind as a shared library." ON)
+option(LIBUNWIND_ENABLE_CROSS_UNWINDING "Enable cross-platform unwinding support." ON)
set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE STRING "GCC toolchain for cross compiling.")
set(LIBUNWIND_SYSROOT "" CACHE STRING "Sysroot for cross compiling.")
@@ -202,6 +203,11 @@ else()
endif ()
endif ()
+# Cross-unwinding
+if (NOT LIBUNWIND_ENABLE_CROSS_UNWINDING)
+ list(APPEND LIBUNWIND_COMPILE_FLAGS -D_LIBUNWIND_IS_NATIVE_ONLY)
+endif ()
+
# This is the _ONLY_ place where add_definitions is called.
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)