[all-commits] [llvm/llvm-project] 5a082d: [WebAssembly][Object] Remove requirement that obje...

Derek Schuff via All-commits all-commits at lists.llvm.org
Thu Jun 23 13:56:35 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a082d9c1c14df5cee5a45683aee524e9b57a662
  Author: Derek Schuff <dschuff at chromium.org>
  Date:   2022-06-23 (Thu, 23 Jun 2022)

  Changed paths:
    M llvm/include/llvm/Object/Wasm.h
    M llvm/lib/Object/WasmObjectFile.cpp
    A llvm/test/tools/llvm-objdump/wasm/no-codesec.test

  Log Message:
  [WebAssembly][Object] Remove requirement that objects must have code sections

When parsing name and linking sections, we currently require that the object
must have a code section (it seems that this was intended to verify section
ordering). However it can be useful for binaries to have their code sections
stripped out (e.g. if we just want the debug info). In that case we need
the rest of the known sections (so e.g. we know how many functions there
are, to verify the name section) but not the actual code.

I've removed the restriction completely. I think this is OK because the
section-parsing code already checks function and global indices in many
places for validity and will return appropriate errors if the relevant sections
are missing. Also we can't just replace the requirement of seeing a code section
with a requirement  that we see a function or global section, because a binary
may just not have any functions or globals.
But there's only an problem if the name or linking section tries to name a
nonexistent function.

Part of a fix for https://github.com/emscripten-core/emscripten/issues/13084

Differential Revision: https://reviews.llvm.org/D128094

More information about the All-commits mailing list