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/link: documentation should mention that -s implies -w #71051

Closed
rittneje opened this issue Dec 28, 2024 · 2 comments
Closed

cmd/link: documentation should mention that -s implies -w #71051

rittneje opened this issue Dec 28, 2024 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Documentation FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rittneje
Copy link

Go version

n/a

Output of go env in your module/workspace:

n/a

What did you do?

Read the documentation for go tool link, specifically with regards to the -s and -w flags.

What did you see happen?

There documentation only states:

-s
	Omit the symbol table and debug information.
[...]
-w
	Omit the DWARF symbol table.

Only the Go 1.22 release notes seem to explain their interaction.

The linker’s -s and -w flags are now behave more consistently across all platforms. The -w flag suppresses DWARF debug information generation. The -s flag suppresses symbol table generation. The -s flag also implies the -w flag, which can be negated with -w=0. That is, -s -w=0 will generate a binary with DWARF debug information generation but without the symbol table.

What did you expect to see?

The documentation for -s should explicitly say that it implies -w by default, and that you can override this by explicitly passing -w=0. (In short, developers should not have to track down the 1.22 release notes to understand how these two flags interact.)

@gopherbot gopherbot added compiler/runtime Issues related to the Go compiler and/or runtime. Documentation labels Dec 28, 2024
@gabyhelp
Copy link

Related Issues

Related Code Changes

Related Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

willboland added a commit to willboland/golang-go that referenced this issue Dec 29, 2024
The Go 1.22 release notes note that the -s flag implies -w; however, the documentation makes no such reference. This updates the documentation to better match the release notes.

The Go 1.22 release notes can be found at https://tip.golang.org/doc/go1.22#linker

Fixes golang#71051
willboland added a commit to willboland/golang-go that referenced this issue Dec 29, 2024
The Go 1.22 release notes note that the -s flag implies -w; however, the documentation makes no such reference. This updates the documentation to better match the release notes.

The Go 1.22 release notes can be found at https://tip.golang.org/doc/go1.22#linker

Fixes golang#71051
willboland added a commit to willboland/golang-go that referenced this issue Dec 29, 2024
The Go 1.22 release notes state that -s implies -w; however, the documentation makes no such reference. This updates the documentation to better match the release notes.

The Go 1.22 release notes can be found at https://tip.golang.org/doc/go1.22#linker

Fixes golang#71051
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/638976 mentions this issue: cmd/link: document that -s implies -w

@dmitshur dmitshur added this to the Go1.24 milestone Dec 30, 2024
@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. FixPending Issues that have a fix which has not yet been reviewed or submitted. labels Dec 30, 2024
@dmitshur dmitshur moved this to All-But-Submitted in Go Compiler / Runtime Dec 30, 2024
@github-project-automation github-project-automation bot moved this from All-But-Submitted to Done in Go Compiler / Runtime Dec 30, 2024
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. Documentation FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done.
Projects
Development

Successfully merging a pull request may close this issue.

4 participants