WebAssembly / WebAssembly/wabt

wabbt - ReadBinaryIR() -> WriteBinaryModule() -> emnm output.o :: error: output.o: out of order section type: 0

Open
#1,951 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
8.1k
Forks
827
Avg merge
4d 6h
Merged PRs (30d)
18

Description

I've been debugging my transformation, and I've found if I read in a wasm file with ReadBinaryIR() and then just write it back with no modification using WriteBinaryModule(), then I can't link with the new object. E.g. emnm gives and error, out of order section type:0

Interestingly, if I then do:

wasm2wat output.o -o output.wat
wat2wasm --relocatable output.wat -o output.o

Then the object thats been translated by wasm2wat and back works correctly.

I've tried to look if there are some options I'm missing in the binary reader/writer but I can't see a difference between what wasm2wat does.

Does anyone know what I might be missing?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported path by reading a wasm file with ReadBinaryIR() and writing it with WriteBinaryModule(), then test whether emnm rejects the resulting output.o with an out-of-order section type error. Compare that output with the wasm2wat and wat2wasm --relocatable round trip; done means the directly translated object links successfully without the conversion workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, wasm
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.