OSDN Git Service

[llvm-objcopy]Preserve data in segments not covered by sections
authorJames Henderson <jh7370@my.bristol.ac.uk>
Mon, 25 Mar 2019 16:36:26 +0000 (16:36 +0000)
committerJames Henderson <jh7370@my.bristol.ac.uk>
Mon, 25 Mar 2019 16:36:26 +0000 (16:36 +0000)
commitea6301340f3886e8c7e87b0274449cbc4288269a
tree387aa355d4b139a73f5837da74f9313d6a68688b
parentacd323e334aa98799deee5c52a257e588cf3a902
[llvm-objcopy]Preserve data in segments not covered by sections

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.

Reviewed by: jakehehrlich, rupprecht

Differential Revision: https://reviews.llvm.org/D59483

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356919 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objcopy/ELF/preserve-segment-contents-ehdr-phdrs.test [new file with mode: 0644]
test/tools/llvm-objcopy/ELF/preserve-segment-contents.test [new file with mode: 0644]
tools/llvm-objcopy/ELF/Object.cpp
tools/llvm-objcopy/ELF/Object.h