Skip to content

cmd/go: invalid flag in #cgo LDFLAGS: -zcommon-page-size=2097152 #50680

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
hailingluo opened this issue Jan 19, 2022 · 5 comments
Closed

cmd/go: invalid flag in #cgo LDFLAGS: -zcommon-page-size=2097152 #50680

hailingluo opened this issue Jan 19, 2022 · 5 comments
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@hailingluo
Copy link

hailingluo commented Jan 19, 2022

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

$ go version
go version go1.16.5 linux/arm64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

number_main.go
image

go build -buildmode=pie -ldflags='-v -linkmode=internal' number_main.go

What did you expect to see?

build successfully

What did you see instead?

go build command-line-arguments: invalid flag in #cgo LDFLAGS: -zcommon-page-size=2097152

@bcmills
Copy link
Contributor

bcmills commented Jan 19, 2022

There is an explicit list of allowed flags in cmd/go/internal/work/security.go.

-zcommon-page-size and -zmax-page-size seem safe to add to that list — it appears that -z execstack and -z relro are already accepted — but I will defer to @ianlancetaylor for the final call.

@bcmills bcmills changed the title cmd/link: invalid flag in #cgo LDFLAGS: -zcommon-page-size=2097152 cmd/go: invalid flag in #cgo LDFLAGS: -zcommon-page-size=2097152 Jan 19, 2022
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 19, 2022
@bcmills bcmills added this to the Backlog milestone Jan 19, 2022
@ianlancetaylor
Copy link
Member

Yes, those flags are fine. Want to send a patch for the 1.19 release? Thanks.

@hailingluo
Copy link
Author

hailingluo commented Jan 20, 2022

I have added these two flags into my local go version (1.16.5) and it works.

@seankhliao seankhliao added the GoCommand cmd/go label Feb 22, 2025
@matloob
Copy link
Contributor

matloob commented Mar 25, 2025

@hailingluo Are you interested in sending a patch for this?

@matloob matloob added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 25, 2025
@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants