Navigation Menu

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

Open
inkeliz opened this issue Mar 5, 2022 · 1 comment
Open

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

inkeliz opened this issue Mar 5, 2022 · 1 comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@inkeliz
Copy link

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?

Yes

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

@ALTree
Copy link
Member

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 Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 5, 2022
@ALTree ALTree added this to the Unplanned milestone Mar 5, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants