[all-commits] [llvm/llvm-project] 7f409c: [Object][Wasm] Allow parsing of GC types in type a...

Derek Schuff via All-commits all-commits at lists.llvm.org
Thu Jan 25 09:48:51 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7f409cd82b322038f08a984a07377758e76b0e4c
      https://github.com/llvm/llvm-project/commit/7f409cd82b322038f08a984a07377758e76b0e4c
  Author: Derek Schuff <dschuff at chromium.org>
  Date:   2024-01-25 (Thu, 25 Jan 2024)

  Changed paths:
    M lld/wasm/InputChunks.h
    M lld/wasm/InputElement.h
    M lld/wasm/InputFiles.cpp
    M lld/wasm/WriterUtils.cpp
    M llvm/include/llvm/BinaryFormat/Wasm.h
    M llvm/include/llvm/Object/Wasm.h
    M llvm/lib/MC/WasmObjectWriter.cpp
    M llvm/lib/Object/WasmObjectFile.cpp
    M llvm/lib/ObjectYAML/WasmYAML.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
    A llvm/test/Object/Inputs/WASM/multi-table.wasm
    A llvm/test/Object/wasm-obj2yaml-tables.test

  Log Message:
  -----------
  [Object][Wasm] Allow parsing of GC types in type and table sections (#79235)

This change allows a WasmObjectFile to be created from a wasm file even 
if it uses typed funcrefs and GC types. It does not significantly change how 
lib/Object models its various internal types (e.g. WasmSignature,
WasmElemSegment), so LLVM does not really "support" or understand such
files, but it is sufficient to parse the type, global and element sections, discarding
types that are not understood. This is useful for low-level binary tools such as
nm and objcopy, which use only limited aspects of the binary (such as function
definitions) or deal with sections as opaque blobs.

This is done by allowing `WasmValType` to have a value of `OTHERREF`
(representing any unmodeled reference type), and adding a field to
`WasmSignature` indicating it's a placeholder for an unmodeled reference 
type (since there is a 1:1 correspondence between WasmSignature objects
and types in the type section).
Then the object file parsers for the type and element sections are expanded
to parse encoded reference types and discard any unmodeled fields.




More information about the All-commits mailing list