Skip to content

Commit

Permalink
[CMake] Support externalizing debug info on non-Darwin platforms
Browse files Browse the repository at this point in the history
On other platorms, we use objcopy to export the debug info.

Differential Revision: https://reviews.llvm.org/D28575

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295481 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
petrhosek committed Feb 17, 2017
1 parent b8890be commit 8cea2af
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()

Expand Down

0 comments on commit 8cea2af

Please sign in to comment.