wabt icon indicating copy to clipboard operation
wabt copied to clipboard

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

Open jameswalmsley opened this issue 3 years ago • 1 comments

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?

jameswalmsley avatar Jul 21 '22 14:07 jameswalmsley

Ok I've now found that:

s_write_binary_options.write_debug_names = true

Causes this issue.

jameswalmsley avatar Jul 21 '22 15:07 jameswalmsley