[PATCH] D128094: [WebAssembly][Object] Remove requirement that objects must have code sections

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 13:15:59 PDT 2022


dschuff created this revision.
dschuff added reviewers: aheejin, sbc100.
Herald added subscribers: pmatos, asb, wingo, ecnelises, rupprecht, sunfish, hiraditya, jgravelle-google.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a project: All.
dschuff requested review of this revision.
Herald added subscribers: llvm-commits, StephenFan.
Herald added a project: LLVM.

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 alraedy checks function and global global indices in many
places for validity and will return appropriate errors if the relevant sections
are missing. (Also we can't just always require the presence of e.g. the
function or global sections, because a binary may just have any functions.
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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128094

Files:
  llvm/include/llvm/Object/Wasm.h
  llvm/lib/Object/WasmObjectFile.cpp
  llvm/test/tools/llvm-objdump/wasm/no-codesec.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128094.438028.patch
Type: text/x-patch
Size: 4178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220617/6b7d053b/attachment.bin>


More information about the llvm-commits mailing list