This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Encoding page size in the ELF header


On Mon, Sep 28, 2015 at 11:53:56AM -0400, Carlos O'Donell wrote:
> > which makes it a "minimum alignment". The actual "maximum alignment"
> > is not p_align but rather:
> > 
> > lcm { (ph[i].p_vaddr-ph[i].p_offset) - (ph[j].p_vaddr-ph[j].p_offset) }
> > 
> > where i,j range over all PT_LOAD headers. With a larger page size you
> > cannot simultaneously satisfy the displacement constraints between
> > segments.
> 
> Right.
> 
> In summary:
> 
> Roland's right, you could use p_align from the first PT_LOAD segment
> to guess the largest possible page alignment supported by the binary.
> It's not the truth though, you might support larger if the page alignment
> was a multiple of p_align. You might also support much smaller if you
> only have one PT_LOAD segment (Rich's lcm equation always being correct).
> 
> Does any of this help you solve your problem? :-)

Actually I misspoke; page size has to divide all of the above, not be
divisible by them, so it should be gcd not lcm. :-)

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]