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 $) + if(APPLE) + set(strip_command COMMAND xcrun strip -Sxl $) + else() + set(strip_command COMMAND strip -gx $) + 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 $ $.debug + ${strip_command} -R .gnu_debuglink + COMMAND objcopy --add-gnu-debuglink=$.debug $ + ) endif() endfunction()