[llvm] r359819 - build: add option to disable unwind tables
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Thu May 2 12:37:26 PDT 2019
Author: compnerd
Date: Thu May 2 12:37:26 2019
New Revision: 359819
URL: http://llvm.org/viewvc/llvm-project?rev=359819&view=rev
Log:
build: add option to disable unwind tables
The unwind tables (`.eh_frame`, `.arm.extab`) add a significant chunk of data to
the final binaries. These should not be needed normally, particularly when
exceptions are disabled. This enables shrinking `lldb-server` by ~18% (3 MiB)
when built with gold.
Modified:
llvm/trunk/CMakeLists.txt
llvm/trunk/cmake/modules/AddLLVM.cmake
llvm/trunk/docs/CMake.rst
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=359819&r1=359818&r2=359819&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Thu May 2 12:37:26 2019
@@ -351,6 +351,8 @@ if(LLVM_ENABLE_BACKTRACES)
set(ENABLE_BACKTRACES 1)
endif()
+option(LLVM_ENABLE_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)
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=359819&r1=359818&r2=359819&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Thu May 2 12:37:26 2019
@@ -21,6 +21,10 @@ function(llvm_update_compile_flags name)
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-")
Modified: llvm/trunk/docs/CMake.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.rst?rev=359819&r1=359818&r2=359819&view=diff
==============================================================================
--- llvm/trunk/docs/CMake.rst (original)
+++ llvm/trunk/docs/CMake.rst Thu May 2 12:37:26 2019
@@ -266,6 +266,10 @@ LLVM-specific variables
**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".
More information about the llvm-commits
mailing list