[PATCH] D37497: [WebAssembly] Fix getSymbolValue() for globals that are not 32-bit const values.

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 17:46:45 PDT 2017


sbc100 added inline comments.


================
Comment at: lib/Object/WasmObjectFile.cpp:794
     const wasm::WasmGlobal& Global = Globals[GlobalIndex];
+    assert(Global.InitExpr.Opcode == wasm::WASM_OPCODE_I32_CONST);
     return Global.InitExpr.Value.Int32;
----------------
dschuff wrote:
> Is there any way this can happen other than bogus YAML files? (i.e. do we have binary-parsing code yet, that should also have some check?)
Hmm.. you are right, we could have other types there.  I've made this more flexible.  However, nm might not always give meaningful output for binaries not produced by llvm.. which seems reasonable.


https://reviews.llvm.org/D37497





More information about the llvm-commits mailing list