diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 0714c8ce6c16..2084fcfd4d65 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -1215,7 +1215,6 @@ template void ObjFile::postParse() { Err(ctx) << "TLS attribute mismatch: " << &sym << "\n>>> in " << sym.file << "\n>>> in " << this; - hasVersionSyms |= sym.hasVersionSuffix; // Handle non-COMMON defined symbol below. !sym.file allows a symbol // assignment to redefine a symbol without an error. if (!sym.isDefined() || secIdx == SHN_UNDEF) @@ -1591,8 +1590,6 @@ template void SharedFile::parse() { s->dsoDefined = true; if (s->file == this) s->versionId = idx; - symbols[firstGlobal + i] = s; - hasVersionSyms = true; } } diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index b00e7a428699..0b186db1ba0d 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -241,7 +241,6 @@ public: StringRef sourceFile; uint32_t andFeatures = 0; bool hasCommonSyms = false; - bool hasVersionSyms = false; ArrayRef aarch64PauthAbiCoreInfo; }; diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index 758ca882740e..648da94989d7 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -353,21 +353,9 @@ void SymbolTable::scanVersionScript() { // Symbol themselves might know their versions because symbols // can contain versions in the form of @. // Let them parse and update their names to exclude version suffix. - for (ELFFileBase *file : ctx.objectFiles) { - if (!file->hasVersionSyms) - continue; - for (Symbol *sym : file->getGlobalSymbols()) - if (sym->hasVersionSuffix) - sym->parseSymbolVersion(ctx); - } - // Only used for undefined symbol suggestion. - for (ELFFileBase *file : ctx.sharedFiles) { - if (!file->hasVersionSyms) - continue; - for (Symbol *sym : file->getGlobalSymbols()) - if (sym && sym->hasVersionSuffix) - sym->parseSymbolVersion(ctx); - } + for (Symbol *sym : symVector) + if (sym->hasVersionSuffix) + sym->parseSymbolVersion(ctx); // isPreemptible is false at this point. To correctly compute the binding of a // Defined (which is used by includeInDynsym(ctx)), we need to know if it is diff --git a/lld/test/ELF/symver.s b/lld/test/ELF/symver.s index 526fd2f29159..d05fcc2a55d3 100644 --- a/lld/test/ELF/symver.s +++ b/lld/test/ELF/symver.s @@ -139,7 +139,8 @@ # W3: error: undefined symbol: __wrap_foo@v1 # W3-NEXT: >>> referenced by {{.*}}ref1.o:(.text+0x1) -# W3-NOT: {{.}} +# W3-NEXT: >>> did you mean: __wrap_foo{{$}} +# W3-NEXT: >>> defined in: {{.*}}wrap.o ## foo@v1 is correctly wrapped. # RUN: ld.lld -shared --soname=t --version-script=%t/ver --wrap=foo@v1 %t/ref.o %t/ref1.o %t/def1.o %t/wrap1.o -o %t.w4