From: Petr Hosek Date: Fri, 17 Feb 2017 19:29:12 +0000 (+0000) Subject: [CMake] Support externalizing debug info on non-Darwin platforms X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8cea2afdc7dc9f2414623b194bf0be8a6fef53c3;p=llvm [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295481 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index cb4171c9bc8..7f7608cff33 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -1387,7 +1387,11 @@ function(llvm_externalize_debuginfo name) endif() if(NOT LLVM_EXTERNALIZE_DEBUGINFO_SKIP_STRIP) - set(strip_command COMMAND xcrun strip -Sxl $) + if(APPLE) + set(strip_command COMMAND xcrun strip -Sxl $) + else() + set(strip_command COMMAND strip -gx $) + 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 $ $.debug + ${strip_command} -R .gnu_debuglink + COMMAND objcopy --add-gnu-debuglink=$.debug $ + ) endif() endfunction()