[PATCH] D39132: [llvm-objcopy] Fix bug in how segment alignment was being handled

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 20 11:43:50 PDT 2017


jakehehrlich created this revision.

Just aligning segment offsets to segment alignment is incorrect and also wastes more space than is needed. The requirement is that p_offset == p_addr modulo p_align *not* that p_offset == 0 modulo p_align. Generally speaking we've been using p_addr == 0 modulo p_align. In fact yaml2obj can't even produce a valid situation which causes llvm-objcopy to produce incorrect results because alignment and offset were both inherited from the sections the program header covers.  This change fixes this bad behavior in llvm-objcopy.


Repository:
  rL LLVM

https://reviews.llvm.org/D39132

Files:
  test/tools/llvm-objcopy/check-addr-offset-align.test
  tools/llvm-objcopy/Object.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39132.119674.patch
Type: text/x-patch
Size: 3687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171020/5555a7e0/attachment.bin>


More information about the llvm-commits mailing list