diff --git a/contrib/llvm/tools/lld/ELF/InputFiles.cpp b/contrib/llvm/tools/lld/ELF/InputFiles.cpp index ccf4b3d7673f..52c65dd8ee70 100644 --- a/contrib/llvm/tools/lld/ELF/InputFiles.cpp +++ b/contrib/llvm/tools/lld/ELF/InputFiles.cpp @@ -281,6 +281,10 @@ template ArrayRef ObjFile::getLocalSymbols() { return makeArrayRef(this->Symbols).slice(1, this->FirstNonLocal - 1); } +template ArrayRef ObjFile::getGlobalSymbols() { + return makeArrayRef(this->Symbols).slice(this->FirstNonLocal); +} + template void ObjFile::parse(DenseSet &ComdatGroups) { // Read section and symbol tables. diff --git a/contrib/llvm/tools/lld/ELF/InputFiles.h b/contrib/llvm/tools/lld/ELF/InputFiles.h index dda1de81570c..70109f002e98 100644 --- a/contrib/llvm/tools/lld/ELF/InputFiles.h +++ b/contrib/llvm/tools/lld/ELF/InputFiles.h @@ -167,6 +167,7 @@ public: static bool classof(const InputFile *F) { return F->kind() == Base::ObjKind; } ArrayRef getLocalSymbols(); + ArrayRef getGlobalSymbols(); ObjFile(MemoryBufferRef M, StringRef ArchiveName); void parse(llvm::DenseSet &ComdatGroups); diff --git a/contrib/llvm/tools/lld/ELF/SymbolTable.cpp b/contrib/llvm/tools/lld/ELF/SymbolTable.cpp index c3a00bea4aaa..c41e2b2de748 100644 --- a/contrib/llvm/tools/lld/ELF/SymbolTable.cpp +++ b/contrib/llvm/tools/lld/ELF/SymbolTable.cpp @@ -130,7 +130,10 @@ template void SymbolTable::addCombinedLTOObject() { for (InputFile *File : LTO->compile()) { DenseSet DummyGroups; - cast>(File)->parse(DummyGroups); + auto *Obj = cast>(File); + Obj->parse(DummyGroups); + for (Symbol *Sym : Obj->getGlobalSymbols()) + Sym->parseSymbolVersion(); ObjectFiles.push_back(File); } }