diff options
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r-- | lld/ELF/OutputSections.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 2bc1fa991b9..07e79b1adf1 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -367,6 +367,14 @@ bool lld::elf2::includeInDynamicSymtab(const SymbolBody &B) { return B.isUsedInDynamicReloc(); } +bool lld::elf2::shouldKeepInSymtab(StringRef SymName) { + if (Config->DiscardNone) + return true; + + // ELF defines dynamic locals as symbols which name starts with ".L". + return !(Config->DiscardLocals && SymName.startswith(".L")); +} + template <class ELFT> SymbolTableSection<ELFT>::SymbolTableSection( SymbolTable &Table, StringTableSection<ELFT::Is64Bits> &StrTabSec, |