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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 05:04:33 PDT 2016


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

All that can be implemented initially with just a single page size.

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

I would like to see someone measure the benefit of that in a lld
produced binary before we add this feature.

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


More information about the llvm-commits mailing list