[PATCH] D56205: Add -z common-page-size option

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 10 10:49:04 PST 2019


peter.smith added a comment.

I don't it is correct to use common-page-size to override the value of max-page-size. My understanding of common-page-size is that it is used to save memory in some cases when the same page in the file can be mapped at a different virtual address. At the moment I don't think LLD supports this so there isn't any benefit in having a different common-page-size.

See DATA_SEGMENT_ALIGN in https://sourceware.org/binutils/docs/ld/Builtin-Functions.html#Builtin-Functions

In the default ld.bfd linker script we have at the start of the RW:

  /* Adjust the address for the data segment.  We want to adjust up to
       the same address within the page on the next page up.  */
    . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));

The DATA_SEGMENT_ALIGN requires common-page-size to be < the max-page-size and is typically related to the file-system than the memory.

Taking a look at gold it seems to do the same thing as ld.bfd for its internal linker script. I'm guessing that aligning some functions with the common-page-size might be related to the performance of the file-system rather than alignment in memory?

In any case I think we'll need to be able to state more clearly what common-page-size and max-page-size in ld.bfd and gold do before proceeding as I don't think it is as simple as just setting the alignment.


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56205/new/

https://reviews.llvm.org/D56205





More information about the llvm-commits mailing list