[PATCH] D108776: [CMake] Add `--gdb-index` option to linker if split dwarf compiling
Anton Afanasyev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 26 11:42:52 PDT 2021
anton-afanasyev created this revision.
anton-afanasyev added reviewers: dblaikie, beanz.
Herald added subscribers: arphaman, mgorny.
anton-afanasyev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The option `--gdb-index` should be passed to linker if compiler is invoked
with `-gsplit-dwarf` option. This allows debugger to locate the appropriate
units quickly. See "Invocation" section here: https://gcc.gnu.org/wiki/DebugFission
Suggested by @dblaikie here: https://reviews.llvm.org/D68556#1698442
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108776
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -901,6 +901,10 @@
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-gsplit-dwarf)
+ include(LLVMCheckLinkerFlag)
+ llvm_check_linker_flag(CXX "-Wl,--gdb-index" LINKER_SUPPORTS_GDB_INDEX)
+ append_if(LINKER_SUPPORTS_GDB_INDEX "-Wl,--gdb-index"
+ CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
endif()
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108776.368948.patch
Type: text/x-patch
Size: 633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210826/ec24700e/attachment.bin>
More information about the llvm-commits
mailing list