diff options
-rw-r--r-- | lld/wasm/Symbols.h | 3 | ||||
-rw-r--r-- | lld/wasm/Writer.cpp | 20 |
2 files changed, 9 insertions, 14 deletions
diff --git a/lld/wasm/Symbols.h b/lld/wasm/Symbols.h index 744d8a95c6c..8194bcaca38 100644 --- a/lld/wasm/Symbols.h +++ b/lld/wasm/Symbols.h @@ -78,9 +78,6 @@ public: // Only works for globals, not functions. uint32_t getVirtualAddress() const; - // Returns true if an output index has been set for this symbol - bool hasOutputIndex() const { return OutputIndex.hasValue(); } - // Set the output index of the symbol (in the function or global index // space of the output object. void setOutputIndex(uint32_t Index); diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index 4d9d9239adc..82197547523 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -550,18 +550,16 @@ void Writer::calculateOffsets() { } void Writer::calculateImports() { - for (ObjFile *File : Symtab->ObjectFiles) { - for (Symbol *Sym : File->getSymbols()) { - if (Sym->hasOutputIndex() || Sym->isDefined() || Sym->isWeak()) - continue; + for (Symbol *Sym : Symtab->getSymbols()) { + if (Sym->isDefined() || Sym->isWeak()) + continue; - if (Sym->isFunction()) { - Sym->setOutputIndex(FunctionImports.size()); - FunctionImports.push_back(Sym); - } else { - Sym->setOutputIndex(GlobalImports.size()); - GlobalImports.push_back(Sym); - } + if (Sym->isFunction()) { + Sym->setOutputIndex(FunctionImports.size()); + FunctionImports.push_back(Sym); + } else { + Sym->setOutputIndex(GlobalImports.size()); + GlobalImports.push_back(Sym); } } } |