[llvm] 1a52d3d - [cmake] Fix LLVM_USE_SPLIT_DWARF
Michael Liao via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 20:06:13 PST 2020
Author: Michael Liao
Date: 2020-02-28T23:05:55-05:00
New Revision: 1a52d3d47b84e39cbb626572f5cd3a224692df61
URL: https://github.com/llvm/llvm-project/commit/1a52d3d47b84e39cbb626572f5cd3a224692df61
DIFF: https://github.com/llvm/llvm-project/commit/1a52d3d47b84e39cbb626572f5cd3a224692df61.diff
LOG: [cmake] Fix LLVM_USE_SPLIT_DWARF
Summary:
- Add `-gsplit-dwarf` as an option instead of a definition.
- Only add that option on compilers supporting dwarf splitting, such as clang
and gcc.
Reviewers: echristo, pcc
Subscribers: mgorny, aprantl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75328
Added:
Modified:
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index b91523736a3e..b19846c0852c 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -746,9 +746,15 @@ if(LLVM_USE_SANITIZER)
endif()
endif()
-# Turn on -gsplit-dwarf if requested
-if(LLVM_USE_SPLIT_DWARF)
- add_definitions("-gsplit-dwarf")
+# Turn on -gsplit-dwarf if requested in debug builds.
+if (LLVM_USE_SPLIT_DWARF AND
+ ((uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") OR
+ (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO")))
+ # Limit to clang and gcc so far. Add compilers supporting this option.
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
+ CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ add_compile_options(-gsplit-dwarf)
+ endif()
endif()
add_definitions( -D__STDC_CONSTANT_MACROS )
More information about the llvm-commits
mailing list