WebAssembly / WebAssembly/binaryen

Fatal: Module::addExport: empty name when using binaryen.js

Open
#3,313 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Using a release version of Binaryen.js, I am (sometimes) hitting an assertion Fatal: Module::addExport: empty name when calling the C API's _BinaryenAddGlobalExport:

  addGlobalExport(
    internalName: string,
    externalName: string
  ): ExportRef {
    var cStr1 = this.allocStringCached(internalName);
    var cStr2 = this.allocStringCached(externalName);
    console.log(internalName, cStr1, readString(cStr1), externalName, cStr2, readString(cStr2));
    return binaryen._BinaryenAddGlobalExport(this.ref, cStr1, cStr2);
  }

logging

src/types/Type.i64 6075288 src/types/Type.i64 Type.i64 16669480 Type.i64

indicating that the string arguments are not empty (or null) and can be read back properly.

The error goes away when using a debug build with https://github.com/WebAssembly/binaryen/pull/3311 applied.

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

Start by reproducing the failure through Binaryen.js and the C API entry point _BinaryenAddGlobalExport in a release build, then compare it with a debug build using pull request 3311. Done means valid non-empty names no longer trigger the Module::addExport assertion in the release build.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wasm
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.