[WebAssembly] Don't error when --undefined symbols are not found
This matches the behavior of the ELF linker where -u/--undefined
means symbols will get pulled in from archives but won't result
in link error if they are missing.
Also, don't actually great symbol table entries for the undefined
symbols, again matching more closely the ELF linker.
This also results in simplification of the code.
Differential Revision: https://reviews.llvm.org/D50279
llvm-svn: 338938
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index 13a3c6f..2a4249e 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -60,7 +60,6 @@
}
void SymbolTable::reportRemainingUndefines() {
- SetVector<Symbol *> Undefs;
for (Symbol *Sym : SymVector) {
if (!Sym->isUndefined() || Sym->isWeak())
continue;
@@ -68,20 +67,8 @@
continue;
if (!Sym->IsUsedInRegularObj)
continue;
- Undefs.insert(Sym);
+ error(toString(Sym->getFile()) + ": undefined symbol: " + toString(*Sym));
}
-
- if (Undefs.empty())
- return;
-
- for (ObjFile *File : ObjectFiles)
- for (Symbol *Sym : File->getSymbols())
- if (Undefs.count(Sym))
- error(toString(File) + ": undefined symbol: " + toString(*Sym));
-
- for (Symbol *Sym : Undefs)
- if (!Sym->getFile())
- error("undefined symbol: " + toString(*Sym));
}
Symbol *SymbolTable::find(StringRef Name) {