[PATCH] D41893: [WebAssembly] Create synthetic __wasm_call_ctors function
Andrew Scheidecker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 18:00:38 PST 2018
AndrewScheidecker requested changes to this revision.
AndrewScheidecker added inline comments.
This revision now requires changes to proceed.
================
Comment at: wasm/Writer.cpp:695
+ raw_string_ostream OS(CtorFunctionBody);
+ writeUleb128(OS, 2 + (2 * InitFunctions.size()), "function size");
+ writeUleb128(OS, 0, "num locals");
----------------
This size needs to account for the variable length function indices. Perhaps just wait until after the encoded function is generated to compute the size?
================
Comment at: wasm/Writer.cpp:698
+ for (const WasmInitFunc &F : InitFunctions) {
+ writeUleb128(OS, OPCODE_CALL, "END");
+ writeUleb128(OS, F.FunctionIndex, "function index");
----------------
“END” -> “CALL”
Also, instructions don’t use leb128 encoding.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D41893
More information about the llvm-commits
mailing list