diff --git a/lld/wasm/Relocations.cpp b/lld/wasm/Relocations.cpp --- a/lld/wasm/Relocations.cpp +++ b/lld/wasm/Relocations.cpp @@ -34,15 +34,11 @@ static bool allowUndefined(const Symbol* sym) { // Undefined functions and globals with explicit import name are allowed to be // undefined at link time. - if (auto *f = dyn_cast(sym)) - if (f->importName || config->importUndefined) - return true; - if (auto *g = dyn_cast(sym)) - if (g->importName) - return true; - if (auto *g = dyn_cast(sym)) - if (g->importName) - return true; + if (sym->importName) + return true; + if (isa(sym) || config->importUndefined) + return true; + return config->allowUndefinedSymbols.count(sym->getName()) != 0; }