Skip to content

Go gcflags and ldflags can't be specified multiple times #49037

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

Closed
kirillx opened this issue Oct 18, 2021 · 2 comments
Closed

Go gcflags and ldflags can't be specified multiple times #49037

kirillx opened this issue Oct 18, 2021 · 2 comments

Comments

@kirillx
Copy link
Contributor

kirillx commented Oct 18, 2021

Most compilers like GCC would take multiple -ldflags arguments, and concatenate them to produce a list of additional arguments to ld.

go build is not doing so, and uses only the last -ldflags. Fortunately it is not completely that bad, and handles -ldflags ""
(an empty argument after -ldflags) as a no-op, so scripting is still possible.

So the proposal is to concatenate multiple gcflags/ldflags. If no objections - would provide PR.

What version of Go are you using (go version)?

$ go version
go version go1.17.1 darwin/amd64

Does this issue reproduce with the latest release?

yes

@mvdan
Copy link
Member

mvdan commented Oct 18, 2021

Perhaps a duplicate of #38522?

@seankhliao
Copy link
Member

Duplicate of #38522

@seankhliao seankhliao marked this as a duplicate of #38522 Oct 18, 2021
@golang golang locked and limited conversation to collaborators Oct 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants