cmd/go: allow -buildmode=pie with -race on macOS #62318
Labels
FrozenDueToAge
GoCommand
cmd/go
NeedsFix
The path to resolution is known, but the work has not been done.
OS-Darwin
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go build -buildmode=pie -race something.go
What did you expect to see?
The command to work without issues.
What did you see instead?
-buildmode=pie not supported when -race is enabled
Some more context:
On darwin/arm64 -buildmode=pie is fact required and is used by default. This means that even if I do
go build -race something.go
I still get a PIE binary. (see the code here: https://github.com/golang/go/blob/master/src/internal/platform/supported.go#L236)It used to be that on macOS/amd64 I would not get a PIE binary, but as of 3 weeks ago that is not the case anymore: f7b4f02
This means that you always get a PIE binary when targeting macOS, even with the -race flag, yet if you explicitly specify that you want a PIE binary, it prints out an error. This is very confusing and should be fixed.
I suggest doing something like:
(note that the patch above is for Go 1.20 so it may be slightly different for the latest version)
The text was updated successfully, but these errors were encountered: