OSDN Git Service

[llvm-objcopy] Add --only-keep-debug as a noop
authorJake Ehrlich <jakehehrlich@google.com>
Tue, 15 May 2018 20:53:53 +0000 (20:53 +0000)
committerJake Ehrlich <jakehehrlich@google.com>
Tue, 15 May 2018 20:53:53 +0000 (20:53 +0000)
commitbcc9a743a6289639fdd4f4928de38f6620656855
tree2e1387c955f7d76c474dc496e70eda6ee11478e7
parent8d19d135affd06e436ab5052c7d14e47be1419a7
[llvm-objcopy] Add --only-keep-debug as a noop

This option just keeps being a problem and really needs to be implemented
in some fashion. Implementing it properly requires some kind of
"replaceSectionReference" method because all the existing links need to be
maintained. The desired behavior is just for allocated sections to become
NOBITS but actually implementing that is rather tricky due to the current
design of llvm-objcopy. However converting allocated sections to NOBITS is
just an optimization and not something debuggers need. Debuggers can debug
a stripped executable and take an unstripped executable for that stripped
executable as input. Additionally allocated sections account for a very
small part of debug binaries so this optimization is quite small. I propose
that for the time being we implement this as a NOP so that people can use
llvm-objcopy where they need to, just in a sub-optimal way.

This option has already blocked a lot of people and its currently blocking me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332396 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objcopy/basic-only-keep-debug.test [new file with mode: 0644]
tools/llvm-objcopy/ObjcopyOpts.td
tools/llvm-objcopy/llvm-objcopy.cpp