[PATCH] D40523: [llvm-objcopy] Add --only-keep-debug

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 14:29:31 PST 2017


jakehehrlich created this revision.
Herald added subscribers: JDevlieghere, aprantl.

GNU objcopy has two complimentary options to split files into debug and non-debug parts. --strip-debug is very simple. It's complementary option --only-keep-debug is a bit more complicated. --only-keep debug attempts to keep all section headers but remove any non-debug information it can. GNU objcopy appears to accomplish this by making every allocated section into a SHT_NOBITS section. The GNU objcopy man page explains that this is because the section headers have to be kept so that the debugger knows what parts of the file are what and can match the parts of the two files up.  Note I plan on adding --add-gnu-debuglink and an option akin to -split-dwarf that will do all of these things at once for you in another commit.


Repository:
  rL LLVM

https://reviews.llvm.org/D40523

Files:
  test/tools/llvm-objcopy/replace-strtab-dynamic-error.test
  test/tools/llvm-objcopy/replace-strtab-dynsym-error.test
  test/tools/llvm-objcopy/replace-text-symtab.test
  tools/llvm-objcopy/Object.cpp
  tools/llvm-objcopy/Object.h
  tools/llvm-objcopy/llvm-objcopy.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40523.124465.patch
Type: text/x-patch
Size: 10785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171127/ae87cbc3/attachment.bin>


More information about the llvm-commits mailing list