[PATCH] D28575: [CMake] Support externalizing debug info on non-Darwin platforms

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 14:32:17 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL295481: [CMake] Support externalizing debug info on non-Darwin platforms (authored by phosek).

Changed prior to commit:
  https://reviews.llvm.org/D28575?vs=88574&id=88957#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D28575

Files:
  llvm/trunk/cmake/modules/AddLLVM.cmake


Index: llvm/trunk/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake
+++ llvm/trunk/cmake/modules/AddLLVM.cmake
@@ -1387,7 +1387,11 @@
   endif()
 
   if(NOT LLVM_EXTERNALIZE_DEBUGINFO_SKIP_STRIP)
-    set(strip_command COMMAND xcrun strip -Sxl $<TARGET_FILE:${name}>)
+    if(APPLE)
+      set(strip_command COMMAND xcrun strip -Sxl $<TARGET_FILE:${name}>)
+    else()
+      set(strip_command COMMAND strip -gx $<TARGET_FILE:${name}>)
+    endif()
   endif()
 
   if(APPLE)
@@ -1403,7 +1407,11 @@
       ${strip_command}
       )
   else()
-    message(FATAL_ERROR "LLVM_EXTERNALIZE_DEBUGINFO isn't implemented for non-darwin platforms!")
+    add_custom_command(TARGET ${name} POST_BUILD
+      COMMAND objcopy --only-keep-debug $<TARGET_FILE:${name}> $<TARGET_FILE:${name}>.debug
+      ${strip_command} -R .gnu_debuglink
+      COMMAND objcopy --add-gnu-debuglink=$<TARGET_FILE:${name}>.debug $<TARGET_FILE:${name}>
+      )
   endif()
 endfunction()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28575.88957.patch
Type: text/x-patch
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170217/bdb0bd4f/attachment.bin>


More information about the llvm-commits mailing list