Start of relro segment adjustment
H.J. Lu
hjl.tools@gmail.com
Wed Apr 1 11:26:00 GMT 2015
On Wed, Apr 1, 2015 at 2:11 AM, Alan Modra <amodra@gmail.com> wrote:
> Adjusting the start of the relro segment in order to make it end
> exactly on a page boundary runs into difficulties when sections in the
> relro segment are aligned; Adjusting the start by (next_page - end)
> sometimes results in more than that adjustment occurring at the end,
> overrunning the page boundary. So when that occurs we try a new lower
> start position by masking the adjusted start with the maximum section
> alignment. However, we didn't consider that this masked start address
> may in fact be before the initial relro base, which is silly since
> that can only increase padding at the relro end.
>
> I've also moved some calculations closer to where they are used, and
> comments closer to the relevant statements.
>
> * ldlang.c (lang_size_sections): When alignment of sections
> results in relro base adjustment being too large, don't go lower
> than the initial value.
> * ldexp.c (fold_binary <DATA_SEGMENT_RELRO_END>): Comment.
> * scripttempl/elf.sc (DATA_SEGMENT_ALIGN): Omit SEGMENT_SIZE
> alignment when SEGMENT_SIZE is the same as MAXPAGESIZE.
>
Thanks.
I checked in this testcase.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-a-testcase-for-PR-ld-18176.patch
Type: text/x-patch
Size: 5466 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150401/bb00c4b7/attachment.bin>
More information about the Binutils
mailing list