[PATCH] D59989: [llvm-objcopy]Allow llvm-objcopy to be used on an ELF file with no section headers

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 29 06:11:44 PDT 2019


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

This patch fixes https://bugs.llvm.org/show_bug.cgi?id=41293 and https://bugs.llvm.org/show_bug.cgi?id=41045. llvm-objcopy assumed that it could always read a section header string table. This isn't the case when the sections were previously all stripped, and the e_shstrndx field was set to 0. This patch fixes this. It also fixes a double space in an error message relating to this issue, and prevents llvm-objcopy from adding extra space for non-existent section headers, meaning that --strip-sections on the output of a previous --strip-sections run produces identical output, simplifying the test.


Repository:
  rL LLVM

https://reviews.llvm.org/D59989

Files:
  test/tools/llvm-objcopy/ELF/copy-after-strip-sections.test
  tools/llvm-objcopy/ELF/Object.cpp
  tools/llvm-objcopy/ELF/Object.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59989.192812.patch
Type: text/x-patch
Size: 3764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190329/4eefb260/attachment.bin>


More information about the llvm-commits mailing list