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

Exposed by pr34872.s

llvm-svn: 370875
This commit is contained in:
Fangrui Song 2019-09-04 11:02:58 +00:00
parent 2c9f83cfab
commit 520bdf79b5
1 changed files with 1 additions and 1 deletions

View File

@ -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);