diff options
Diffstat (limited to 'lld/ELF/Symbols.cpp')
-rw-r--r-- | lld/ELF/Symbols.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 3ffb50744c5..7707d3d583c 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -172,6 +172,31 @@ template <class ELFT> typename ELFT::uint SymbolBody::getSize() const { return 0; } +template <class ELFT> +const OutputSection *SymbolBody::getOutputSection() const { + if (auto *S = dyn_cast<DefinedRegular<ELFT>>(this)) { + if (S->Section) + return S->Section->template getOutputSection<ELFT>(); + return nullptr; + } + + if (auto *S = dyn_cast<SharedSymbol>(this)) { + if (S->NeedsCopy) + return S->Section->OutSec; + return nullptr; + } + + if (isa<DefinedCommon>(this)) { + if (Config->DefineCommon) + return In<ELFT>::Common->OutSec; + return nullptr; + } + + if (auto *S = dyn_cast<DefinedSynthetic>(this)) + return S->Section; + return nullptr; +} + // If a symbol name contains '@', the characters after that is // a symbol version name. This function parses that. void SymbolBody::parseSymbolVersion() { @@ -359,6 +384,15 @@ 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 const OutputSection * + SymbolBody::template getOutputSection<ELF32LE>() const; +template const OutputSection * + SymbolBody::template getOutputSection<ELF32BE>() const; +template const OutputSection * + SymbolBody::template getOutputSection<ELF64LE>() const; +template const OutputSection * + SymbolBody::template getOutputSection<ELF64BE>() const; + template class elf::DefinedRegular<ELF32LE>; template class elf::DefinedRegular<ELF32BE>; template class elf::DefinedRegular<ELF64LE>; |