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/go: invalid flag in #cgo LDFLAGS: -zcommon-page-size=2097152 #50680

Open
hailingluo opened this issue Jan 19, 2022 · 3 comments
Open

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

hailingluo opened this issue Jan 19, 2022 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
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
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants