diff options
-rw-r--r-- | lld/ELF/Target.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/Target.h | 2 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 5 |
3 files changed, 5 insertions, 4 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 83b723d0c0e..f01c7299ec8 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -145,6 +145,8 @@ TargetInfo *createTarget() { TargetInfo::~TargetInfo() {} +uint64_t TargetInfo::getVAStart() const { return Config->Shared ? 0 : VAStart; } + bool TargetInfo::relocNeedsCopy(uint32_t Type, const SymbolBody &S) const { return false; } diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index 3c78beae2c5..71ef7eb8584 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -22,7 +22,7 @@ class SymbolBody; class TargetInfo { public: unsigned getPageSize() const { return PageSize; } - uint64_t getVAStart() const { return VAStart; } + uint64_t getVAStart() const; unsigned getCopyReloc() const { return CopyReloc; } unsigned getPCRelReloc() const { return PCRelReloc; } unsigned getGotReloc() const { return GotReloc; } diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 9592ba48628..5bed591ab9e 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -55,7 +55,6 @@ private: bool isOutputDynamic() const { return !Symtab.getSharedFiles().empty() || Config->Shared; } - uintX_t getVAStart() const { return Config->Shared ? 0 : Target->getVAStart(); } uintX_t getEntryAddr() const; int getPhdrsNum() const; @@ -677,7 +676,7 @@ static uint32_t toPhdrFlags(uint64_t Flags) { // Visits all sections to create PHDRs and to assign incremental, // non-overlapping addresses to output sections. template <class ELFT> void Writer<ELFT>::assignAddresses() { - uintX_t VA = getVAStart() + sizeof(Elf_Ehdr); + uintX_t VA = Target->getVAStart() + sizeof(Elf_Ehdr); uintX_t FileOff = sizeof(Elf_Ehdr); // Calculate and reserve the space for the program header first so that @@ -697,7 +696,7 @@ template <class ELFT> void Writer<ELFT>::assignAddresses() { Interp = &Phdrs[++PhdrIdx]; // Add the first PT_LOAD segment for regular output sections. - setPhdr(&Phdrs[++PhdrIdx], PT_LOAD, PF_R, 0, getVAStart(), FileOff, + setPhdr(&Phdrs[++PhdrIdx], PT_LOAD, PF_R, 0, Target->getVAStart(), FileOff, Target->getPageSize()); Elf_Phdr TlsPhdr{}; |