[PATCH] D59483: [llvm-objcopy]Preserve data in segments not covered by sections

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 05:39:11 PDT 2019


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

llvm-objcopy previously knew nothing about data in segments that wasn't covered by section headers, meaning that it wrote zeroes instead of what was there. As it is possible for this data to be useful to the loader, this patch causes llvm-objcopy to start preserving this data. Data in sections that are explicitly removed continues to be written as zeroes.

This fixes https://bugs.llvm.org/show_bug.cgi?id=41005.

The test is possibly more complicated than the current implementation warrants, but did pick up several problems with an earlier implementation, so I'd prefer to keep the test cases rather than reduce it down.


Repository:
  rL LLVM

https://reviews.llvm.org/D59483

Files:
  test/tools/llvm-objcopy/ELF/preserve-segment-contents.test
  tools/llvm-objcopy/ELF/Object.cpp
  tools/llvm-objcopy/ELF/Object.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59483.191067.patch
Type: text/x-patch
Size: 23102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190318/979a97f0/attachment.bin>


More information about the llvm-commits mailing list