OSDN Git Service

[llvm-objcopy] Use physical instead of virtual address when aligning and placing...
authorJake Ehrlich <jakehehrlich@google.com>
Mon, 22 Jan 2018 19:27:30 +0000 (19:27 +0000)
committerJake Ehrlich <jakehehrlich@google.com>
Mon, 22 Jan 2018 19:27:30 +0000 (19:27 +0000)
commitc127e0c9742f746fe7198222bf6442b81787292e
treec30998f665b8a7865ab135ae2639ed39c52e2915
parentca19eaabd75f55865efd321b7a6f1d4ba3db8bc8
[llvm-objcopy] Use physical instead of virtual address when aligning and placing sections in binary

For sections with different virtual and physical addresses, alignment and
placement in the output binary should be based on the physical address.

Ran into this problem with a bare metal ARM project where llvm-objcopy added a
lot of zero-padding before the .data section that had differing addresses. GNU
objcopy did not add the padding, and after this fix, neither does llvm-objcopy.

Update a test case so a section has different physical and virtual addresses.

Fixes B35708

Authored By: Owen Shaw (owenpshaw)

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323144 91177308-0d34-0410-b5e6-96231b3b80d8
test/tools/llvm-objcopy/binary-no-paddr.test [new file with mode: 0644]
test/tools/llvm-objcopy/binary-paddr.test [new file with mode: 0644]
test/tools/llvm-objcopy/binary-segment-layout.test [moved from test/tools/llvm-objcopy/basic-align-copy.test with 77% similarity]
test/tools/llvm-objcopy/two-seg-remove-end.test
test/tools/llvm-objcopy/two-seg-remove-first.test
test/tools/llvm-objcopy/two-seg-remove-third-sec.test
tools/llvm-objcopy/Object.cpp