[PATCH] D92323: [WebAssembly][MC] Fix placement of table section

Andy Wingo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 00:21:12 PST 2020


wingo added inline comments.


================
Comment at: llvm/lib/MC/WasmObjectWriter.cpp:1814
     writeFunctionSection(Functions);
+    writeTableSection(Tables);
     // Skip the "memory" section; we import the memory instead.
----------------
sbc100 wrote:
> I don't understand how moving the table section before Events and Globals relates to being able to use externref and funcref as block types.
> 
> Aren't all types defined in the type section?   And also.. the blocks themselves are all defined in Code section which is after all of these isn't it?
They are only related in the sense that they were just two small things that I needed to fix to assemble and link https://github.com/Igalia/ref-cpp/blob/master/milestones/m3/test.S.

Regarding this specific block, the table section must go after functions and before events.  The existing tests only validated before because the tests didn't include events or globals.  Once you start linking things with globals, you run into validation problems, both in wasm-ld when it parses object files, and in external tools.


================
Comment at: llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp:343
         .Case("exnref", WebAssembly::BlockType::Exnref)
+        .Case("externref", WebAssembly::BlockType::Externref)
+        .Case("funcref", WebAssembly::BlockType::Funcref)
----------------
I assume this will be subsumed by https://reviews.llvm.org/D92359


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92323/new/

https://reviews.llvm.org/D92323



More information about the llvm-commits mailing list