OSDN Git Service

[llvm][llvm-objcopy] When outputting to binary don't output segments that cover no...
authorPetr Hosek <phosek@chromium.org>
Fri, 4 Aug 2017 23:18:18 +0000 (23:18 +0000)
committerPetr Hosek <phosek@chromium.org>
Fri, 4 Aug 2017 23:18:18 +0000 (23:18 +0000)
commitfdd2cc8254c9c10635e49e793cab4df8275f7c92
tree44d153feb192eaf2f934c44c49d7cb5f1a79f3d1
parent0b67c739d8828d1aaac7c7c18c0525a404628a7f
[llvm][llvm-objcopy] When outputting to binary don't output segments that cover no sections

Sometimes LLD will produce a PT_LOAD segment that only covers the
headers (and covers no sections). GNU objcopy does not output the
segment contents for these sections. In particular this is an issue in
building magenta because the final link step for the kernel would
produce just such a PT_LOAD segment. This change is to support this case
and to match what GNU objcopy does in this case.

Patch by Jake Ehrlich

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310149 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objcopy/Inputs/pt-phdr.elf [new file with mode: 0644]
test/tools/llvm-objcopy/sectionless-segment.test [new file with mode: 0644]
tools/llvm-objcopy/Object.cpp