[PATCH] D111741: Ensure LLVM_EXTERNALIZE_DEBUGINFO goes to bin/ not foo/bar/

Jo Shields via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 13 10:12:10 PDT 2021


directhex created this revision.
Herald added a subscriber: mgorny.
directhex requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This aligns with the Windows behaviour, where .pdb files go to bin/ not foo/bar/ (e.g. tools/llc/) - and it makes more sense to put the debug files next to the executables that they pair with.

If LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR is absolute, put files in there, otherwise the path is relative to bin/ not foo/bar/.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111741

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -2003,6 +2003,7 @@
       set(CMAKE_DSYMUTIL xcrun dsymutil)
     endif()
     add_custom_command(TARGET ${name} POST_BUILD
+      WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR}
       COMMAND ${CMAKE_DSYMUTIL} ${output_path} $<TARGET_FILE:${name}>
       ${strip_command}
       )
@@ -2020,6 +2021,7 @@
       # If an output dir is specified, it must be manually mkdir'd on Linux,
       # as that directory needs to exist before we can pipe to a file in it.
       add_custom_command(TARGET ${name} POST_BUILD
+        WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR}
         COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR}
         )
     else()
@@ -2027,6 +2029,7 @@
     endif()
 
     add_custom_command(TARGET ${name} POST_BUILD
+      WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR}
       COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $<TARGET_FILE:${name}> ${output_path}
       ${strip_command} -R .gnu_debuglink
       COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${output_path} $<TARGET_FILE:${name}>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111741.379450.patch
Type: text/x-patch
Size: 1233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211013/096a0100/attachment.bin>


More information about the llvm-commits mailing list