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

cmd/nm: don't work with WebAssembly binaries #51500

inkeliz opened this issue Mar 5, 2022 · 1 comment

cmd/nm: don't work with WebAssembly binaries #51500

inkeliz opened this issue Mar 5, 2022 · 1 comment


Copy link

@inkeliz inkeliz commented Mar 5, 2022

What version of Go are you using (go version)?

go version go1.17.5 windows/amd64

Does this issue reproduce with the latest release?


What did you do?

I'm trying to get the size of one WebAssembly file, using cmd/nm, as such:

GOOS=js GOARCH=wasm go build -o wasm.wasm .
go tool nm -size wasm.wasm

I also tried: GOOS=js GOARCH=wasm go tool nm -size wasm.wasm.

What did you expect to see?

Since Golang is able to build for WebAssembly, I expect that nm to read such file. I expect that same behavior of Windows executables, such as go tool nm -size windows.exe.

What did you see instead?

Current, WebAssembly is "unrecognized", it returns:

open wasm.wasm: unrecognized object file

Copy link

@ALTree ALTree commented Mar 5, 2022

cmd/nm is for Go archives/object files, and executables. I believe GOARCH=wasm just emits wasm bytecode, which is possibly out of scope for Go's nm command. It should be analyzed with wasm-specific tools.

@ALTree ALTree added the NeedsDecision label Mar 5, 2022
@ALTree ALTree added this to the Unplanned milestone Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants