[lld] r370875 - [ELF] Fix spell corrector: don't call elf::InputFile::getSymbols() on shared objects

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 04:02:58 PDT 2019


Author: maskray
Date: Wed Sep  4 04:02:58 2019
New Revision: 370875

URL: http://llvm.org/viewvc/llvm-project?rev=370875&view=rev
Log:
[ELF] Fix spell corrector: don't call elf::InputFile::getSymbols() on shared objects

Exposed by pr34872.s

Modified:
    lld/trunk/ELF/Relocations.cpp

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=370875&r1=370874&r2=370875&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Sep  4 04:02:58 2019
@@ -697,7 +697,7 @@ static std::vector<UndefinedDiag> undefs
 static const Symbol *getAlternativeSpelling(const Undefined &sym) {
   // Build a map of local defined symbols.
   DenseMap<StringRef, const Symbol *> map;
-  if (sym.file) {
+  if (sym.file && !isa<SharedFile>(sym.file)) {
     for (const Symbol *s : sym.file->getSymbols())
       if (s->isLocal() && s->isDefined())
         map.try_emplace(s->getName(), s);




More information about the llvm-commits mailing list