[llvm] r295481 - [CMake] Support externalizing debug info on non-Darwin platforms
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 11:29:12 PST 2017
Author: phosek
Date: Fri Feb 17 13:29:12 2017
New Revision: 295481
URL: http://llvm.org/viewvc/llvm-project?rev=295481&view=rev
Log:
[CMake] Support externalizing debug info on non-Darwin platforms
On other platorms, we use objcopy to export the debug info.
Differential Revision: https://reviews.llvm.org/D28575
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=295481&r1=295480&r2=295481&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Fri Feb 17 13:29:12 2017
@@ -1387,7 +1387,11 @@ function(llvm_externalize_debuginfo name
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 @@ function(llvm_externalize_debuginfo name
${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()
More information about the llvm-commits
mailing list