[PATCH] D19600: [ELF] - Implemented -z max-page-size option.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 01:13:13 PDT 2016


grimar added a comment.

In http://reviews.llvm.org/D19600#414041, @rafael wrote:

> What is using this?
>
> Cheers,
> Rafael


I saw 3 reasons to implement this:

1. 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.

2. 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).
3. Some platforms requires different page sizes, for example armv6 wants 16kb: https://bugzilla.mozilla.org/show_bug.cgi?id=772886




http://reviews.llvm.org/D19600





More information about the llvm-commits mailing list