diff options
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r-- | lld/ELF/Writer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index cce4122f28d..6293505f067 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -24,6 +24,15 @@ using namespace lld::elf2; static const int PageSize = 4096; +// On freebsd x86_64 the first page cannot be mmaped. +// On linux that is controled by vm.mmap_min_addr. At least on some x86_64 +// installs that is 65536, so the first 15 pages cannot be used. +// Given that, the smallest value that can be used in here is 0x10000. +// If using 2MB pages, the smallest page aligned address that works is +// 0x200000, but it looks like every OS uses 4k pages for executables. +// FIXME: This is architecture and OS dependent. +static const int VAStart = 0x10000; + namespace { static uint32_t toPHDRFlags(uint64_t Flags) { @@ -93,7 +102,7 @@ private: return !Symtab.getSharedFiles().empty() || Config->Shared; } bool needsDynamicSections() const { return isOutputDynamic(); } - unsigned getVAStart() const { return Config->Shared ? 0 : Target->getVAStart(); } + unsigned getVAStart() const { return Config->Shared ? 0 : VAStart; } std::unique_ptr<llvm::FileOutputBuffer> Buffer; |