[lld] r249760 - [ELF2] Make the system page size a target-dependent property

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 06:12:22 PDT 2015


On 8 October 2015 at 18:23, Hal Finkel via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Modified: lld/trunk/ELF/Writer.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=249760&r1=249759&r2=249760&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Writer.cpp (original)
> +++ lld/trunk/ELF/Writer.cpp Thu Oct  8 17:23:54 2015
> @@ -484,8 +482,8 @@ template <class ELFT> void Writer<ELFT>:
>
>    // Reserve space for PHDRs.
>    ProgramHeaderOff = FileOff;
> -  FileOff = RoundUpToAlignment(FileOff, PageSize);
> -  VA = RoundUpToAlignment(VA, PageSize);
> +  FileOff = RoundUpToAlignment(FileOff, Target->getPageSize());
> +  VA = RoundUpToAlignment(VA, Target->getPageSize());
>
>    if (needsInterpSection())
>      PHDRs.push_back(&InterpPHDR);

Rounding up to a page here is one of the issues affecting LLD on
FreeBSD that I posted about a couple of days ago (although it predates
the change quoted above from r249760).  Rounding up puts the PT_INTERP
and ELF ABI notes outside of the first page.

As a local hack I changed it to round up to 512 to continue
investigating other FreeBSD issues and that's sufficient for me to get
further, but we need to be more clever than just reserving the first
page for the PHDRs.


More information about the llvm-commits mailing list