[PATCH] D27042: lld: Default image base address to 0x400000

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 09:46:40 PST 2016


On 23 November 2016 at 12:34, Meador Inge via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
> My original question was: why 2MB?  I am just curious how we arrived at
> that number (for my own education).

The comment in D27042 explains it:

// Align to the large page size (known as a superpage or huge page).
// FreeBSD automatically promotes large, superpage-aligned allocations.
DefaultImageBase = 0x200000;

x86-64 supports 4K and 2M pages and FreeBSD automatically promotes
allocations, so we get a performance benefit of aligning to 2M the
text segment, when it is sufficiently large. I don't think that Linux
does this automatically, but it could be done there too.


More information about the llvm-commits mailing list