[PATCH] D61448: build: disable unwind tables whenever possible

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 10:35:12 PDT 2019


compnerd updated this revision to Diff 197826.
compnerd added a comment.

- provide an option to control the behaviour
- add some documentation


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61448/new/

https://reviews.llvm.org/D61448

Files:
  CMakeLists.txt
  cmake/modules/AddLLVM.cmake
  docs/CMake.rst


Index: docs/CMake.rst
===================================================================
--- docs/CMake.rst
+++ docs/CMake.rst
@@ -266,6 +266,10 @@
 **LLVM_ENABLE_THREADS**:BOOL
   Build with threads support, if available. Defaults to ON.

+**LLVM_ENABLE_UNWIND_TABLES**:BOOL
+  Enable unwind tables in the binary.  Disabling unwind tables can reduce the
+  size of the libraries.  Defaults to ON.
+
 **LLVM_CXX_STD**:STRING
   Build with the specified C++ standard. Defaults to "c++11".

Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -21,6 +21,10 @@
   else()
     if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
       list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions")
+      if(NOT LLVM_ENABLE_UNWIND_TABLES)
+        list(APPEND LLVM_COMPILE_FLAGS "-fno-unwind-tables")
+        list(APPEND LLVM_COMPILE_FLAGS "-fno-asynchronous-unwind-tables")
+      endif()
     elseif(MSVC)
       list(APPEND LLVM_COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0)
       list(APPEND LLVM_COMPILE_FLAGS "/EHs-c-")
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -351,6 +351,8 @@
   set(ENABLE_BACKTRACES 1)
 endif()

+option(LLVM_INCLUDE_UNWIND_TABLES "Emit unwind tables for the libraries" ON)
+
 option(LLVM_ENABLE_CRASH_OVERRIDES "Enable crash overrides." ON)
 if(LLVM_ENABLE_CRASH_OVERRIDES)
   set(ENABLE_CRASH_OVERRIDES 1)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61448.197826.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190502/2f381db2/attachment.bin>


More information about the llvm-commits mailing list