Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm2wast prints incorrect name for global export #286

Closed
sunfishcode opened this issue Jan 22, 2017 · 0 comments
Closed

wasm2wast prints incorrect name for global export #286

sunfishcode opened this issue Jan 22, 2017 · 0 comments

Comments

@sunfishcode
Copy link
Member

sunfishcode commented Jan 22, 2017

With this binary:

$ hexdump -C t.o
00000000  00 61 73 6d 0d 00 00 00  01 84 80 80 80 00 01 60  |.asm...........`|
00000010  00 00 03 82 80 80 80 00  01 00 06 86 80 80 80 00  |................|
00000020  01 7f 01 41 00 0b 07 90  80 80 80 00 02 03 62 61  |...A..........ba|
00000030  72 00 00 06 64 5f 67 6c  6f 62 03 00 0a 85 80 80  |r...d_glob......|
00000040  80 00 01 03 00 0f 0b 00  8b 80 80 80 00 04 6e 61  |..............na|
00000050  6d 65 01 03 62 61 72 00                           |me..bar.|
00000058

wasm2wast prints this:

$ wasm2wast t.o
(module
  (type (;0;) (func))
  (func bar (type 0)
    return)
  (global (;0;) (mut i32) (i32.const 0))
  (export "bar" (func bar))
  (export "d_glob" (global bar)))

It's printing bar as the name of the global in the export, which is incorrect. It appears to be using a name from the "name" section, which only contains function names.

The "name" section is for function names, but there doesn't currently appear to be a section for global names. I filed WebAssembly/design#964 to ask whether there's interest in adding sections for globals and so on.

binji added a commit that referenced this issue Jan 23, 2017
The name section currently only provides names for functions and locals.
This fixes issue #286.
binji added a commit that referenced this issue Jan 23, 2017
The name section currently only provides names for functions and locals.
This fixes issue #286.
binji added a commit that referenced this issue Jan 23, 2017
The name section currently only provides names for functions and locals.
This fixes issue #286.
@binji binji closed this as completed Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants