-z max-page-size can be used to set the target's page size.
This can be used for some platforms requiring different value
from common one.
Details
Diff Detail
Event Timeline
I saw 3 reasons to implement this:
- If we are going to support linkerscript commands one day like:
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1));
. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
. = DATA_SEGMENT_END (.);
It uses 2 different page sizes: common page size and max page size.
DATA_SEGMENT_ALIGN command can be used to perform optimization - save
a bit of runtime memory, but consume more file space More details are here: https://sourceware.org/ml/binutils/2002-02/msg00265.html
Even if we will not support DATA_SEGMENT_ALIGN (I think it is possible just to ignore such command and its optimization), then we still might want to implement
that optimization for regular use (without LS). And we will need options to control max page size and common page size I guess.
- It seems that tweaking page size can affect perfomance: ld currently uses 2mb page for x64 (https://www.sourceware.org/ml/binutils/2006-05/msg00279.html).
- Some platforms requires different page sizes, for example armv6 wants 16kb: https://bugzilla.mozilla.org/show_bug.cgi?id=772886
I saw 3 reasons to implement this:
- If we are going to support linkerscript commands one day like:
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1));
. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
. = DATA_SEGMENT_END (.);It uses 2 different page sizes: common page size and max page size.
DATA_SEGMENT_ALIGN command can be used to perform optimization - save
a bit of runtime memory, but consume more file space More details are here: https://sourceware.org/ml/binutils/2002-02/msg00265.html
Even if we will not support DATA_SEGMENT_ALIGN (I think it is possible just to ignore such command and its optimization), then we still might want to implement
that optimization for regular use (without LS). And we will need options to control max page size and common page size I guess.
All that can be implemented initially with just a single page size.
- It seems that tweaking page size can affect perfomance: ld currently uses 2mb page for x64 (https://www.sourceware.org/ml/binutils/2006-05/msg00279.html).
I would like to see someone measure the benefit of that in a lld
produced binary before we add this feature.
- Some platforms requires different page sizes, for example armv6 wants 16kb: https://bugzilla.mozilla.org/show_bug.cgi?id=772886
That can be done directly in the linker.
Cheers,
Rafael