[PATCH] D59293: [llvm-objcopy]Don't implicitly strip sections in segments

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 04:33:00 PDT 2019


jhenderson created this revision.
jhenderson added reviewers: jakehehrlich, alexshap, rupprecht, grimar.
Herald added subscribers: MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

This patch changes llvm-objcopy's behaviour to not strip sections that are in segments, if they otherwise would be due to a stripping operation (--strip-all, --strip-sections, --strip-non-alloc). This preserves the segment contents. It does not change the behaviour of --strip-all-gnu (although we could choose to do so), because GNU objcopy's behaviour in this case seems to be to strip the section, nor does it prevent removing of sections in segments with --remove-section (if a user REALLY wants to remove a section, we should probably let them, although I could be persuaded that warning might be appropriate). Tests have been added to show this latter behaviour.

I haven't modified --strip-debug's behaviour (i.e. a debug section in a segment will be stripped), but I'd be happy to.


Repository:
  rL LLVM

https://reviews.llvm.org/D59293

Files:
  test/tools/llvm-objcopy/ELF/remove-section-in-segment.test
  test/tools/llvm-objcopy/ELF/strip-all-gnu.test
  test/tools/llvm-objcopy/ELF/strip-all.test
  test/tools/llvm-objcopy/ELF/strip-non-alloc.test
  test/tools/llvm-objcopy/ELF/strip-sections.test
  tools/llvm-objcopy/ELF/ELFObjcopy.cpp
  tools/llvm-objcopy/ObjcopyOpts.td
  tools/llvm-objcopy/StripOpts.td

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59293.190396.patch
Type: text/x-patch
Size: 10014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190313/1416ccf9/attachment.bin>


More information about the llvm-commits mailing list