[ELF2] Remove Writer::getVAStart, use TargetInfo::getVAStart instead.
llvm-svn: 252593
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index 83b723d..f01c729 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -145,6 +145,8 @@
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 3c78bea..71ef7eb 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -22,7 +22,7 @@
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 9592ba4..5bed591 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -55,7 +55,6 @@
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 @@
// 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 @@
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{};