[PATCH] D37497: [WebAssembly] Ensure that Wasm global that represent memory addresses are 32-bit const values
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 5 17:44:20 PDT 2017
sbc100 updated this revision to Diff 113942.
sbc100 added a comment.
- handle 64bit global exports
https://reviews.llvm.org/D37497
Files:
lib/Object/WasmObjectFile.cpp
Index: lib/Object/WasmObjectFile.cpp
===================================================================
--- lib/Object/WasmObjectFile.cpp
+++ lib/Object/WasmObjectFile.cpp
@@ -791,7 +791,14 @@
uint32_t GlobalIndex = Exports[Sym.ElementIndex].Index - NumImportedGlobals;
assert(GlobalIndex < Globals.size());
const wasm::WasmGlobal& Global = Globals[GlobalIndex];
- return Global.InitExpr.Value.Int32;
+ switch (Global.InitExpr.Opcode) {
+ case wasm::WASM_OPCODE_I32_CONST:
+ return Global.InitExpr.Value.Int32;
+ case wasm::WASM_OPCODE_I64_CONST:
+ return Global.InitExpr.Value.Int64;
+ default:
+ return 0;
+ }
}
case WasmSymbol::SymbolType::DEBUG_FUNCTION_NAME:
return Sym.ElementIndex;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37497.113942.patch
Type: text/x-patch
Size: 761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170906/5f22a549/attachment.bin>
More information about the llvm-commits
mailing list