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

Exposed by pr34872.s

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@370875 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/ELF/Relocations.cpp b/ELF/Relocations.cpp
index 32fe2f1..42f0a87 100644
--- a/ELF/Relocations.cpp
+++ b/ELF/Relocations.cpp
@@ -697,7 +697,7 @@
 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);