ppci
ppci copied to clipboard
Reading section failed
Hi, I tried to load an existing WASM module (maybe a bit unusual module, I don't know).
<ipython-input-5-a1926f0a6fca> in <module>
----> 1 wasm.Module(open(r'/home/ekarni/pyodide/addlibs/__loader.wasm','rb'))
~/.pyenv/versions/3.9.6/lib/python3.9/site-packages/ppci/wasm/components.py in __init__(self, *input)
109 elif hasattr(arg, "read"):
110 assert not hasattr(arg, "read_module")
--> 111 return self._from_file(arg)
112
113 # Else, more direct instantiation
~/.pyenv/versions/3.9.6/lib/python3.9/site-packages/ppci/wasm/components.py in _from_file(self, f)
248
249 reader = BinaryFileReader(f)
--> 250 reader.read_module(self)
251
252 def to_string(self):
~/.pyenv/versions/3.9.6/lib/python3.9/site-packages/ppci/wasm/binary/reader.py in read_module(self, module)
58 section_data = self.read_length_prefixed_bytes()
59 with self.push_data(section_data):
---> 60 self.read_section(section_id)
61
62 logger.info(
~/.pyenv/versions/3.9.6/lib/python3.9/site-packages/ppci/wasm/binary/reader.py in read_section(self, section_id)
69 def read_section(self, section_id):
70 """ Process a single section. """
---> 71 section_name = self._section_id_to_name[section_id]
72 logger.debug("Loading %s section", section_name)
73
KeyError: 12
A very simple module does work. This module was compiled by emcc. I can upload it.