]> Cypherpunks repositories - gostls13.git/commit
cmd/go: permit additional cflags when compiling
authorHolger Hans Peter Freyther <freythergo@gmail.com>
Sun, 24 Sep 2023 12:05:37 +0000 (12:05 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 25 Sep 2023 18:16:01 +0000 (18:16 +0000)
commitbc9da01e9d7de25f04173f7122e09fe0996aaa05
tree051db7f78383438c08ed0de20237c3dbbcef3740
parent70e04706d8ccd4c93de54e1f5c7b15c942018dee
 cmd/go: permit additional cflags when compiling

In CL 475375 the Go command started to generate the "preferlinkext"
token file for "strange/dangerous" compiler flags. This serves as a hint
to the Go linker whether to call the external linker or not.

Permit compiler flags used by bazel and bazelbuild/rules_go during
compilation of cgo code to not prefer external linking. This restores
the behavior of previous versions of Go.

As a side effect, it also allows these flags to appear
in #cgo directives in source code. We don't know of any cases
where that is actually useful, but it appears to be harmless
and simplifies the implementation of the internal linking change.

Fixes #60865

Change-Id: I176a6a2a2cf36293dd9aed24be928f98fa2fb6d9
GitHub-Last-Rev: 071e915b8e4e6b466e1accbfd2b9b45fc9982a34
GitHub-Pull-Request: golang/go#60868
Reviewed-on: https://go-review.googlesource.com/c/go/+/504335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
src/cmd/go/internal/work/security.go
src/cmd/go/testdata/script/cgo_suspect_flag_force_external.txt