aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WasmObjectFile.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-09-26 21:10:09 +0000
committerSam Clegg <sbc@chromium.org>2017-09-26 21:10:09 +0000
commitba9fa9fd168f3cb74be749c77df73ada3ee0c27d (patch)
tree13f0adbe8e1b4991133dfaaa4fbfc2e346abd77f /llvm/lib/Object/WasmObjectFile.cpp
parente22ebeab1a98a8c3e8b36ba56cd0d1a1dd433dc7 (diff)
downloadllvm-ba9fa9fd168f3cb74be749c77df73ada3ee0c27d.zip
llvm-ba9fa9fd168f3cb74be749c77df73ada3ee0c27d.tar.gz
llvm-ba9fa9fd168f3cb74be749c77df73ada3ee0c27d.tar.bz2
[WebAssembly] Model weakly defined symbols as wasm exports
Previously these were being included as both imports and exports, with the import being satisfied by the export (or some strong symbol) at runtime. However proved unnecessary and actually complicated linking as it meant there was not a 1-to-1 mapping between a wasm function /global index and a linker symbol. Differential Revision: https://reviews.llvm.org/D38246 llvm-svn: 314245
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index c320b91..1954335 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -337,19 +337,11 @@ void WasmObjectFile::populateSymbolTable() {
Export.Kind == wasm::WASM_EXTERNAL_FUNCTION
? WasmSymbol::SymbolType::FUNCTION_EXPORT
: WasmSymbol::SymbolType::GLOBAL_EXPORT;
- auto Pair = SymbolMap.try_emplace(Export.Name, Symbols.size());
- if (Pair.second) {
- Symbols.emplace_back(Export.Name, ExportType,
- ExportSection, Export.Index);
- DEBUG(dbgs() << "Adding export: " << Symbols.back()
- << " sym index:" << Symbols.size() << "\n");
- } else {
- uint32_t SymIndex = Pair.first->second;
- Symbols[SymIndex] =
- WasmSymbol(Export.Name, ExportType, ExportSection, Export.Index);
- DEBUG(dbgs() << "Replacing existing symbol: " << Symbols[SymIndex]
- << " sym index:" << SymIndex << "\n");
- }
+ SymbolMap.try_emplace(Export.Name, Symbols.size());
+ Symbols.emplace_back(Export.Name, ExportType,
+ ExportSection, Export.Index);
+ DEBUG(dbgs() << "Adding export: " << Symbols.back()
+ << " sym index:" << Symbols.size() << "\n");
}
}
}