summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/WasmObjectWriter.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-02-21 17:05:19 +0000
committerSam Clegg <sbc@chromium.org>2019-02-21 17:05:19 +0000
commit1ed3a0467c93817f669ece91bf008e3997e98230 (patch)
treee2e9157ec48185ef4c04f018075fe8188f023493 /llvm/lib/MC/WasmObjectWriter.cpp
parentddf91af5a67bef9ca7a6f14277420e8d2dc0c66e (diff)
downloadbcm5719-llvm-1ed3a0467c93817f669ece91bf008e3997e98230.tar.gz
bcm5719-llvm-1ed3a0467c93817f669ece91bf008e3997e98230.zip
[WebAssembly] Don't create MSSymbolWasm object for non-symbols
`__linear_memory` and `__indirect_function_table` are both generated as imports in wasm object files but are actually symbols and don't appear in any symbols table or relocation entry. Indeed we don't have any symbol type to meaningfully represent either of them. Differential Revision: https://reviews.llvm.org/D58487 llvm-svn: 354599
Diffstat (limited to 'llvm/lib/MC/WasmObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/WasmObjectWriter.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 10f16ba3c8f..d8dfc57c416 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -1148,7 +1148,6 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm,
uint64_t StartOffset = W.OS.tell();
LLVM_DEBUG(dbgs() << "WasmObjectWriter::writeObject\n");
- MCContext &Ctx = Asm.getContext();
// Collect information from the available symbols.
SmallVector<WasmFunction, 4> Functions;
@@ -1164,22 +1163,18 @@ uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm,
// For now, always emit the memory import, since loads and stores are not
// valid without it. In the future, we could perhaps be more clever and omit
// it if there are no loads or stores.
- auto *MemorySym =
- cast<MCSymbolWasm>(Ctx.getOrCreateSymbol("__linear_memory"));
wasm::WasmImport MemImport;
- MemImport.Module = MemorySym->getImportModule();
- MemImport.Field = MemorySym->getImportName();
+ MemImport.Module = "env";
+ MemImport.Field = "__linear_memory";
MemImport.Kind = wasm::WASM_EXTERNAL_MEMORY;
Imports.push_back(MemImport);
// For now, always emit the table section, since indirect calls are not
// valid without it. In the future, we could perhaps be more clever and omit
// it if there are no indirect calls.
- auto *TableSym =
- cast<MCSymbolWasm>(Ctx.getOrCreateSymbol("__indirect_function_table"));
wasm::WasmImport TableImport;
- TableImport.Module = TableSym->getImportModule();
- TableImport.Field = TableSym->getImportName();
+ TableImport.Module = "env";
+ TableImport.Field = "__indirect_function_table";
TableImport.Kind = wasm::WASM_EXTERNAL_TABLE;
TableImport.Table.ElemType = wasm::WASM_TYPE_FUNCREF;
Imports.push_back(TableImport);
OpenPOWER on IntegriCloud