[PATCH] D111742: Add LLVM_EXTERNALIZE_DEBUGINFO_FLATTEN, which can do flat dSYM

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


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

As standard, dsymutil creates a directory structure for symbols - for example, llc goes to llc.dSYM/Contents/Resources/DWARF/llc.

dsymutil also accepts a -f/--flat parameter, which emits a single file without the extra directory baggage, e.g. llc to llc.dwarf.

Add a CMake option to enable this mode


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111742

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1980,6 +1980,8 @@
   if(APPLE)
     if(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION)
       set(file_ext ${LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION})
+    elseif(LLVM_EXTERNALIZE_DEBUGINFO_FLATTEN)
+      set(file_ext dwarf)
     else()
       set(file_ext dSYM)
     endif()
@@ -1992,6 +1994,12 @@
       set(output_path "-o=${output_name}")
     endif()
 
+    if(LLVM_EXTERNALIZE_DEBUGINFO_FLATTEN)
+      set(flatten_debuginfo "--flat")
+    else()
+      set(flatten_debuginfo "")
+    endif()
+
     if(CMAKE_CXX_FLAGS MATCHES "-flto"
       OR CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} MATCHES "-flto")
 
@@ -2004,7 +2012,7 @@
     endif()
     add_custom_command(TARGET ${name} POST_BUILD
       WORKING_DIRECTORY ${LLVM_RUNTIME_OUTPUT_INTDIR}
-      COMMAND ${CMAKE_DSYMUTIL} ${output_path} $<TARGET_FILE:${name}>
+      COMMAND ${CMAKE_DSYMUTIL} ${flatten_debuginfo} ${output_path} $<TARGET_FILE:${name}>
       ${strip_command}
       )
   else()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111742.379452.patch
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211013/bcd66930/attachment.bin>


More information about the llvm-commits mailing list