Further tidies to bed->p_align code
align_pagesize was used for two things, reducing p->p_align from
maxpagesize to the bed->p_align value (section alignment permitting),
and increasing p->p_align above maxpagesize if section alignment
required that. This patch untangles those two, making align_pagesize
only do the former. p->p_align is set directly for the latter. I've
made that change to p->p_align only when D_PAGED to keep things
consistent with other early assignments to p->p_align. p->p_align is
set later according to section alignment when not D_PAGED.
I've also moved the place where align_pagesize adjusts p->p_align to
be with other code setting p->p_align. That seemed better to me than
leaving it until the last possible moment. Note that it isn't
necessary to have this adjustment done inside a test for a PT_LOAD
header, since we never set align_pagesize non-zero outside a PT_LOAD
test.
* elf.c (assign_file_positions_for_load_sections): Clear
align_pagesize whenever we have a section alignment more than
bed->p_align. Set p->p_align rather than align_pagesize
when section alignment exceeds maxpagesize. Assign p->p_align
from align_pagesize earlier.
1 file changed