This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Fix relro when COMMONPAGESIZE < MAXPAGESIZE
Jakub Jelinek <jakub@redhat.com> writes:
> On Thu, Sep 09, 2004 at 02:35:17PM +0200, Andreas Schwab wrote:
>> > When there is no COMMONPAGESIZE definition, that tells the linker
>> > to not do any DATA_SEGMENT_* adjustements (as even without -z relro
>> > they are disk space unfriendly; though without -z relro they may
>> > waste just up to COMMONPAGESIZE bytes on the disk).
>>
>> If COMMONPAGESIZE is equal to MAXPAGESIZE then DATA_SEGMENT_ALIGN is a
>> no-op anyway.
>
> It is not a no-op.
If you have no COMMONPAGESIZE then the data segment alignment is
established by ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1)).
> LOAD 0x000000 0x00000000 0x00000000 0x00544 0x00544 R E 0x1000
> LOAD 0x000544 0x00001544 0x00001544 0x000f8 0x00d34 RW 0x1000
This is exactly what the above expression will calculate for the start of
the data segment.
> Now, can you look at your proposed relro patch and verify that it will
> not cause bigger memory requirements (which at least for me are far worse
> than bigger diskspace, as you need to multiply the additional writable
> page by the number of processes that have the shared library mapped)?
Since all I did was to move up the data segment by multiples of
COMMONPAGESIZE it is obvious that no additional page will be allocated
(unless you have a section with more than COMMONPAGESIZE alignment or your
page size is bigger then COMMONPAGESIZE).
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."