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/link: flag -a does not disassemble output #7517

Open
alexbrainman opened this Issue Mar 12, 2014 · 8 comments

Comments

Projects
None yet
5 participants
@alexbrainman
Member

alexbrainman commented Mar 12, 2014

$ cat a.go
package main

func main() {
        println("aaa")
}
$ go build -ldflags -a a.go 2>&1 | sed '/main.main/,+5!d'
8048c00 main.main
8048c00 658b0d000000008b49f83b21770b31ff
8048c10 31c0e8497e0100ebe783ec088d351079
8048c20 06088d3c24fca5a5e803cb0000e86ecb
8048c30 000083c408c300000000000099000000
8048c40 main.init
$ hg id
5013055ed006 tip
$

that is on linux/386
@robpike

This comment has been minimized.

Contributor

robpike commented Mar 26, 2014

Comment 1:

Issue #7641 has been merged into this issue.

@robpike

This comment has been minimized.

Contributor

robpike commented Mar 26, 2014

Comment 2:

I want this feature back.

Labels changed: added release-go1.3maybe, repo-main.

Status changed to Accepted.

@rsc

This comment has been minimized.

Contributor

rsc commented Mar 27, 2014

Comment 3:

8l never disassembled the output. It listed the assembly language for the output,
but because the assembly language was 8l's input, it was just printing its input,
basically.
Now the conversion from assembly language to machine code happens in 8a/8g/8c
as part of liblink. The -S flag on all of those gives the exact instructions that will be
in the binary, not a pseudo-stream that will be munged by the linker.
(That's why the -S flag is so much noisier now.)
We might be able to make 8l -a produce the old output if we link the libmach disassembler
in and then munge it to do different symbol name resolution. But that will require
changes to
libmach, and we are so very close to deleting it instead.
For Go 1.4 it might be easier since we will have a linker written in Go and a
disassembler
written in Go. But it's still not clear whether it's worthwhile.
I admit it: I love the -a flag too, and I miss it. But I don't see an easy way to bring
it back.
For Go 1.3 I expect we will ship a useful 'go tool objdump', so perhaps instead of 8l -a
you can run 8l to generate an 8.out and then use 'go tool objdump 8.out'.
@alexbrainman

This comment has been minimized.

Member

alexbrainman commented Mar 27, 2014

Comment 4:

Thank you for your explanation Russ. 'go tool objdump' sounds like a plan, lets make it
work. 'go tool objdump' does not do anything useful at this moment (maybe I'm not using
it properly):
C:\>go tool objdump %GOROOT%\bin\go.exe 0 0xffffffff
objdump: syminit: No error
And 'go tool nm' is broken (see issue #6936). And gdb is broken (see issue #7642). So
things are pretty bad right now.
Alex
@rsc

This comment has been minimized.

Contributor

rsc commented Mar 27, 2014

Comment 5:

go tool objdump being broken is issue #7452. Mainly I need a disassembler, which I have
almost working but am doing at lower priority than all the runtime and compiler bugs. :-)
If you'd like to work on issue #6936, it will help the eventual go tool objdump too. I am
not sure how much is involved but it seems like it shouldn't be too bad.
I agree that things are pretty bad. They'll get better.
@minux

This comment has been minimized.

Member

minux commented Mar 27, 2014

Comment 6:

i'd like to help with the disassemblers in Go if possible.
@rsc

This comment has been minimized.

Contributor

rsc commented May 19, 2014

Comment 7:

'go tool objdump' works on x86 now and will work on arm soon. The -a flag in cmd/ld may
come back in 1.4.

Labels changed: added release-go1.4, removed release-go1.3maybe.

@rsc

This comment has been minimized.

Contributor

rsc commented Sep 15, 2014

Comment 8:

Labels changed: added release-go1.5, removed release-go1.4.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014

@bradfitz bradfitz removed the release-go1.5 label Dec 16, 2014

@rsc rsc removed accepted labels Apr 14, 2015

@rsc rsc changed the title from cmd/ld: flag -a does not disassemble output to cmd/link: flag -a does not disassemble output Jun 8, 2015

@rsc rsc modified the milestones: Go1.6Early, Go1.5 Jun 29, 2015

@rsc rsc modified the milestones: Unplanned, Go1.6Early Dec 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment