summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/InputSection.cpp10
-rw-r--r--lld/ELF/Symbols.cpp12
-rw-r--r--lld/ELF/Symbols.h2
3 files changed, 15 insertions, 9 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index d5ff181b4f9..67432dd30b6 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -130,14 +130,6 @@ InputSectionBase<ELFT>::findMipsPairedReloc(uint8_t *Buf, uint32_t SymIndex,
}
template <class ELFT>
-static typename llvm::object::ELFFile<ELFT>::uintX_t
-getSymSize(SymbolBody &Body) {
- if (auto *SS = dyn_cast<DefinedElf<ELFT>>(&Body))
- return SS->Sym.st_size;
- return 0;
-}
-
-template <class ELFT>
template <bool isRela>
void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
RelIteratorRange<isRela> Rels) {
@@ -243,7 +235,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd,
else if (Type == R_MIPS_LO16 && Body == Config->MipsGpDisp)
SymVA = getMipsGpAddr<ELFT>() - AddrLoc + 4;
}
- uintX_t Size = getSymSize<ELFT>(*Body);
+ uintX_t Size = Body->getSize<ELFT>();
Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA + A, Size + A,
findMipsPairedReloc(Buf, SymIndex, Type, NextRelocs));
}
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 30b086f68db..dec844277c1 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -89,6 +89,13 @@ typename ELFFile<ELFT>::uintX_t SymbolBody::getPltVA() const {
PltIndex * Target->PltEntrySize;
}
+template <class ELFT>
+typename ELFFile<ELFT>::uintX_t SymbolBody::getSize() const {
+ if (auto *B = dyn_cast<DefinedElf<ELFT>>(this))
+ return B->Sym.st_size;
+ return 0;
+}
+
static uint8_t getMinVisibility(uint8_t VA, uint8_t VB) {
if (VA == STV_DEFAULT)
return VB;
@@ -252,6 +259,11 @@ template uint32_t SymbolBody::template getPltVA<ELF32BE>() const;
template uint64_t SymbolBody::template getPltVA<ELF64LE>() const;
template uint64_t SymbolBody::template getPltVA<ELF64BE>() const;
+template uint32_t SymbolBody::template getSize<ELF32LE>() const;
+template uint32_t SymbolBody::template getSize<ELF32BE>() const;
+template uint64_t SymbolBody::template getSize<ELF64LE>() const;
+template uint64_t SymbolBody::template getSize<ELF64BE>() const;
+
template int SymbolBody::compare<ELF32LE>(SymbolBody *Other);
template int SymbolBody::compare<ELF32BE>(SymbolBody *Other);
template int SymbolBody::compare<ELF64LE>(SymbolBody *Other);
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index af16124a763..1d67d3b31c5 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -110,6 +110,8 @@ public:
typename llvm::object::ELFFile<ELFT>::uintX_t getGotPltVA() const;
template <class ELFT>
typename llvm::object::ELFFile<ELFT>::uintX_t getPltVA() const;
+ template <class ELFT>
+ typename llvm::object::ELFFile<ELFT>::uintX_t getSize() const;
// A SymbolBody has a backreference to a Symbol. Originally they are
// doubly-linked. A backreference will never change. But the pointer
OpenPOWER on IntegriCloud