Add a SectionBase::getVA helper. NFC.
There were a few too many places duplicating this.
llvm-svn: 328402
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 3bcbe03..8ac3e5f 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -74,8 +74,6 @@
Addend = 0;
}
- const OutputSection *OutSec = IS->getOutputSection();
-
// In the typical case, this is actually very simple and boils
// down to adding together 3 numbers:
// 1. The address of the output section.
@@ -86,7 +84,7 @@
// If you understand the data structures involved with this next
// line (and how they get built), then you have a pretty good
// understanding of the linker.
- uint64_t VA = (OutSec ? OutSec->Addr : 0) + IS->getOffset(Offset);
+ uint64_t VA = IS->getVA(Offset);
if (D.isTls() && !Config->Relocatable) {
if (!Out::TlsPhdr)
@@ -99,7 +97,7 @@
case Symbol::SharedKind: {
auto &SS = cast<SharedSymbol>(Sym);
if (SS.CopyRelSec)
- return SS.CopyRelSec->getParent()->Addr + SS.CopyRelSec->OutSecOff;
+ return SS.CopyRelSec->getVA(0);
if (SS.NeedsPltAddr)
return Sym.getPltVA();
return 0;