[CMake] Support stripping and linking output to .build-id directory
authorPetr Hosek <phosek@chromium.org>
Sat, 9 Mar 2019 01:26:55 +0000 (01:26 +0000)
committerPetr Hosek <phosek@chromium.org>
Sat, 9 Mar 2019 01:26:55 +0000 (01:26 +0000)
commitaac819b84442a57e573e2d87d8903e820e0bee1a
tree69f6c93087700f744fa7279754b237a5f05de4d5
parent65e062655ed8591761f3d7b7ce31bd8f9dd553ef
[CMake] Support stripping and linking output to .build-id directory

When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

llvm-svn: 355765
clang/cmake/caches/Fuchsia-stage2.cmake
llvm/cmake/modules/LLVMExternalProjectUtils.cmake
llvm/runtimes/CMakeLists.txt
llvm/runtimes/llvm-strip-link.in [new file with mode: 0755]