diff options
author | Fangrui Song <maskray@google.com> | 2019-12-04 13:48:19 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-12-15 21:45:25 -0800 |
commit | d28c6d51d1547d9cd7cd5b7e36b4c03f38ef7c67 (patch) | |
tree | 99cea644a539e46378b8a7d7de0e6d0f529f6086 /llvm/tools/llvm-objcopy/llvm-objcopy.cpp | |
parent | 9e119ad69df716b728c8d190ac808fa509818c1e (diff) | |
download | bcm5719-llvm-d28c6d51d1547d9cd7cd5b7e36b4c03f38ef7c67.tar.gz bcm5719-llvm-d28c6d51d1547d9cd7cd5b7e36b4c03f38ef7c67.zip |
[llvm-objcopy][ELF] -O binary: use LMA instead of sh_offset to decide where to write section contents
.text sh_address=0x1000 sh_offset=0x1000
.data sh_address=0x3000 sh_offset=0x2000
In an objcopy -O binary output, the distance between two sections equal
their LMA differences (0x3000-0x1000), instead of their sh_offset
differences (0x2000-0x1000). This patch changes our behavior to match
GNU.
This rule gets more complex when the containing PT_LOAD has
p_vaddr!=p_paddr. GNU objcopy essentially computes
sh_offset-p_offset+p_paddr for each candidate section, and removes the
gap before the first address.
Added tests to binary-paddr.test to catch the compatibility problem.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D71035
Diffstat (limited to 'llvm/tools/llvm-objcopy/llvm-objcopy.cpp')
0 files changed, 0 insertions, 0 deletions