This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy] Add --only-keep-debug as a noop
ClosedPublic

Authored by jakehehrlich on May 14 2018, 4:03 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

jakehehrlich created this revision.May 14 2018, 4:03 PM
phosek accepted this revision.May 14 2018, 4:47 PM

LGTM

This revision is now accepted and ready to land.May 14 2018, 4:47 PM
jhenderson accepted this revision.May 15 2018, 1:25 AM

From what I understand of what you are saying, this switch isn't really that critical to users, but it's needed for command-line compatibility. Is that right?

LGTM, if so.

paulsemel accepted this revision.May 15 2018, 12:32 PM
jakehehrlich closed this revision.May 15 2018, 5:42 PM

I forgot to tag this. Closing.