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
proposal: cmd/objdump: add '-gnu-only' or '-mca' flag #52099
Comments
Why not use gccgo to compile the Go to assembly? https://go.dev/doc/install/gccgo |
cmd/asm is the assembler, i.e. taking text input to convert to binary. It is not a disassembler. The -S output is mainly for debugging purposes. I don't think cmd/asm is the right place to do it. |
@cherrymui yeah, I was waffling over whether to make this for |
cmd/objdump already has a -gnu flag. It may not understand all instructions and have room to improve. But that doesn't need a new proposal. |
@beoran A few reasons. First, I don't have Second, given a Go assembly file, will And, finally, all my assembly code is |
@cherrymui My "proposal" (for lack of a better word) would be a |
Okay, you can just update this proposal. But why not use the system objdump, then? In my opinion if the main purpose is to interacting external tools, it doesn't need to be in the Go distribution. You can write your own tool. |
The typical usage for Parsing the output of system Using Which is why I'd like |
Doing this would not address the calling convention differences. Even if you could convert from Go assembler syntax to GNU assembler syntax, you couldn't call the resulting functions directly, because the calling convention is different. |
@ianlancetaylor yes. But the purpose (well, my purpose) isn't to run it directly, it's to analyze it. |
Another, slightly more difficult solution could be to write a tool that works like llvm-mca but does understand Go assembly. Probably we could use the source code of the Go assembler to help with this? |
There is already |
This proposal has been added to the active column of the proposals project |
Based on the discussion above, this proposal seems like a likely decline. |
No change in consensus, so declined. |
A popular tool for profiling assembly code is
llvm-mca
, which ingests assembly and outputs statistics. However, it does not accept Go's assembly syntax. In order to use it with Go, you have to convert Go's assembly to GNU (or other) assembly.Converting from Go's assembly is difficult. Currently, the best way to do this is to compile the Go code and use
go tool objdump -gnu
orobjdump
and parse the output with Perl/awk/sed/whatever. This is fraught, especially whencmd/objdump
does not understand the Go executable (see #52098).I propose adding a flag to
cmd/objump
to only output GNU or other assembly that the output can be directly ingested by tools likellvm-mca
.I am also open to alternatives. I really just want Go to work with
llvm-mca
. :)The text was updated successfully, but these errors were encountered: