[PATCH] D42872: Fix handling of zero-size segments in llvm-objcopy

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 01:55:29 PST 2018


jhenderson added a comment.

In https://reviews.llvm.org/D42872#1003722, @jakehehrlich wrote:

> That line from the gABI says the following
>
> > p_align
> >  As ``Program Loading'' describes in this chapter of the processor supplement, loadable process segments must have congruent values for p_vaddr and p_offset, modulo the page size. This member gives the value to which the segments are aligned in memory and in the file. Values 0 and 1 mean no alignment is required. Otherwise, p_align should be a positive, integral power of 2, and p_vaddr should equal p_offset, modulo p_align.
>
> e.g. loadable p_align gives the proper alignment and should be the system page size for the file to be properly loadable. We don't need to magically guess/know the system page size because the linker already did that for us and put the value in p_align. "loadable process segments must have congruent values for p_vaddr and p_offset, modulo the page size." is a requirement of loading not on the ELF. p_align is how the ELF encodges that information. The requirement for *all* program headers is that p_offset % p_align == p_vaddr % p_align and there is no other alignment constraint.


So apparently, I completely messed up interpreting a local example :/ Never mind, your understanding makes more sense than mine did!


Repository:
  rL LLVM

https://reviews.llvm.org/D42872





More information about the llvm-commits mailing list