Skip to content

cmd/link: dumpdep output is missing 'from' #73625

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

Open
kruskall opened this issue May 7, 2025 · 3 comments
Open

cmd/link: dumpdep output is missing 'from' #73625

kruskall opened this issue May 7, 2025 · 3 comments
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

@kruskall
Copy link

kruskall commented May 7, 2025

Go version

go1.24.2

Output of go env in your module/workspace:

GOVERSION='go1.24.2'

What did you do?

Consider the following:

package main

import (
	"fmt"
)

func main() {
	fmt.Println("Hi!")
}

built with go build -gcflags="all=-N -l" -ldflags=-dumpdep .

What did you see happen?

Most of the output is of the form from -> to:

e.g.

main.main -> fmt.Println
fmt.Println -> os.Stdout
fmt.Println -> go:itab.*os.File,io.Writer
fmt.Println -> fmt.Fprintln
fmt.Fprintln -> fmt.newPrinter
fmt.Fprintln -> fmt.(*pp).doPrintln
fmt.Fprintln -> fmt.(*pp).free

However some of the lines seem to be missing a from value.

 -> go:info.*fmt.fmt
 -> go:info.*fmt.buffer
 -> go:info.fmt.buffer
 -> go:info.[6]uint8
 -> go:info.*fmt.pp
 -> go:info.io.Writer
 -> go:info.[]interface {}
 -> go:info.reflect.Value
 -> go:info.fmt.fmtFlags
 -> go:info.fmt.Formatter
 -> go:info.fmt.GoStringer
 -> go:info.fmt.Stringer
 -> go:info.int16
 -> go:info.internal/fmtsort.SortedMap
 -> go:info.internal/fmtsort.KeyValue
 -> go:info.reflect.Type

What did you expect to see?

Unless I'm missing something If the parent is missing I'd expect at least a _ (

) but instead the output shows an empty string.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label May 7, 2025
@cherrymui
Copy link
Member

Some symbols don't have a name, like some auxiliary DWARF symbols. That is probably what you see above.

Ideally we want to print to which symbol the auxiliary symbol is attached, but I don't think we have that information handy, if we don't want to build a reverse lookup map just for printing. Alternatively, perhaps we can print the symbol index, e.g.

somefunc -> <unnamed sym 123>
<unnamed sym 123> -> go.info.somevariable

@cherrymui
Copy link
Member

cc @thanm

@cherrymui cherrymui added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label May 8, 2025
@cherrymui cherrymui added this to the Backlog milestone May 8, 2025
@thanm
Copy link
Contributor

thanm commented May 8, 2025

I agree that the dumpdep output handling of aux and unnamed symbols is not great.

I've worked on better dumping options (e.g. https://go-review.googlesource.com/c/go/+/599436) but never managed to get things to the point where I thought it was ready for review. I use CL 599436 routinely when I am debugging linker problems on my own, it shows symbol indices as part of linker dumpdep, and with linker debug options you can get it to show aux symbol relationships (e.g. here).

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
Status: No status
Development

No branches or pull requests

4 participants