[llvm] [CMake] Turn on LLVM_USE_SPLIT_DWARF by default for Linux Debug build (PR #80328)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 4 10:49:17 PST 2024


================
@@ -686,8 +686,14 @@ set(LLVM_UBSAN_FLAGS
 set(LLVM_LIB_FUZZING_ENGINE "" CACHE PATH
   "Path to fuzzing library for linking with fuzz targets")
 
-option(LLVM_USE_SPLIT_DWARF
-  "Use -gsplit-dwarf when compiling llvm and --gdb-index when linking." OFF)
+# Turn on split-dwarf by default for Linux, take effect on Debug/RelWithDbgInfo builds only.
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
----------------
MaskRay wrote:

Perhaps enable this for all ELF OSes as well, including `*BSD`, Android, Fuchsia.

We only need to disable this for `AIX|Darwin|OS390|Windows`.
`LLVM_USE_SPLIT_DWARF`  checks whether the toolchain supports `-gsplit-dwarf` and `-Wl,--gdb-index`. Having the logic just saves two cc/ld invocations for these non-ELF OSes.

@brad0 @DimitryAndric @petrhosek 



https://github.com/llvm/llvm-project/pull/80328


More information about the llvm-commits mailing list