diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2015-10-08 19:36:39 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2015-10-08 19:36:39 +0000 |
| commit | eb84ce8bd17f7b2516a15aca7d37a768f0cf10f6 (patch) | |
| tree | 164f82ba2efd156b469913c1fe691636ed920f05 /lld/ELF/Target.cpp | |
| parent | 200500d6d3bf98212c9cad8eb564c9b9b202fb1f (diff) | |
| download | bcm5719-llvm-eb84ce8bd17f7b2516a15aca7d37a768f0cf10f6.tar.gz bcm5719-llvm-eb84ce8bd17f7b2516a15aca7d37a768f0cf10f6.zip | |
[ELF2] Make VAStart a target-dependent property
Address a FIXME in ELF/Writer.cpp: Make VAStart a target-dependent property.
I've set the values for the existing targets to what I believe to be the
correct values, and updated the regression tests accordingly.
llvm-svn: 249723
Diffstat (limited to 'lld/ELF/Target.cpp')
| -rw-r--r-- | lld/ELF/Target.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 29544939957..298cbd27419 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -36,6 +36,7 @@ X86TargetInfo::X86TargetInfo() { PCRelReloc = R_386_PC32; GotReloc = R_386_GLOB_DAT; GotRefReloc = R_386_GOT32; + VAStart = 0x10000; } void X86TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr, @@ -91,6 +92,14 @@ X86_64TargetInfo::X86_64TargetInfo() { GotReloc = R_X86_64_GLOB_DAT; GotRefReloc = R_X86_64_PC32; RelativeReloc = R_X86_64_RELATIVE; + + // 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. + VAStart = 0x10000; } void X86_64TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr, @@ -192,6 +201,7 @@ void X86_64TargetInfo::relocateOne(uint8_t *Buf, const void *RelP, PPC64TargetInfo::PPC64TargetInfo() { // PCRelReloc = FIXME // GotReloc = FIXME + VAStart = 0x10000000; } void PPC64TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr) const {} @@ -225,6 +235,7 @@ void PPC64TargetInfo::relocateOne(uint8_t *Buf, const void *RelP, uint32_t Type, PPCTargetInfo::PPCTargetInfo() { // PCRelReloc = FIXME // GotReloc = FIXME + VAStart = 0x10000000; } void PPCTargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr) const {} @@ -241,6 +252,7 @@ void PPCTargetInfo::relocateOne(uint8_t *Buf, const void *RelP, uint32_t Type, ARMTargetInfo::ARMTargetInfo() { // PCRelReloc = FIXME // GotReloc = FIXME + VAStart = 0x8000; } void ARMTargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr) const {} @@ -257,6 +269,7 @@ void ARMTargetInfo::relocateOne(uint8_t *Buf, const void *RelP, uint32_t Type, AArch64TargetInfo::AArch64TargetInfo() { // PCRelReloc = FIXME // GotReloc = FIXME + VAStart = 0x400000; } void AArch64TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr) const {} @@ -336,6 +349,7 @@ MipsTargetInfo::MipsTargetInfo() { // PCRelReloc = FIXME // GotReloc = FIXME DefaultEntry = "__start"; + VAStart = 0x400000; } void MipsTargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr, |

