[llvm-objcopy] Add --build-id-link-dir flag
authorJake Ehrlich <jakehehrlich@google.com>
Mon, 3 Dec 2018 19:49:23 +0000 (19:49 +0000)
committerJake Ehrlich <jakehehrlich@google.com>
Mon, 3 Dec 2018 19:49:23 +0000 (19:49 +0000)
commit8ad7779071718ebc07672dbd3c30a9617128a591
tree94ebc9124c68af3d752584bed3534fcaa137bc60
parent3e66d81ec660701607aaf393c8bd831b9ab1fd08
[llvm-objcopy] Add --build-id-link-dir flag

This flag does not exist in GNU objcopy but has a major use case.
Debugging tools support the .build-id directory structure to find
debug binaries. There is no easy way to build this structure up
however. One way to do it is by using llvm-readelf and some crazy
shell magic. This implements the feature directly. It is most often
the case that you'll want to strip a file and send the original to
the .build-id directory but if you just want to send a file to the
.build-id directory you can copy to /dev/null instead.

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

llvm-svn: 348174
llvm/include/llvm/BinaryFormat/ELF.h
llvm/test/tools/llvm-objcopy/ELF/bad-build-id.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/ELF/build-id-link-dir.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test [new file with mode: 0644]
llvm/test/tools/llvm-objcopy/ELF/no-build-id.test [new file with mode: 0644]
llvm/tools/llvm-objcopy/CopyConfig.cpp
llvm/tools/llvm-objcopy/CopyConfig.h
llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
llvm/tools/llvm-objcopy/ELF/Object.h
llvm/tools/llvm-objcopy/ObjcopyOpts.td