This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Implemented -z max-page-size option.
AbandonedPublic

Authored by grimar on Apr 27 2016, 7:57 AM.

Details

Reviewers
ruiu
rafael
Summary

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

Diff Detail

Event Timeline

grimar updated this revision to Diff 55232.Apr 27 2016, 7:57 AM
grimar retitled this revision from to [ELF] - Implemented -z max-page-size option..
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: grimar, llvm-commits.
rafael edited edge metadata.Apr 27 2016, 10:47 AM
rafael added a subscriber: rafael.

What is using this?

Cheers,
Rafael

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.

  1. 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).
  2. 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:

  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.

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

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

grimar abandoned this revision.Jul 27 2016, 7:41 AM

We are not going to support this now.