cmd/go: whitelist -sectcreate
flag in cgo LDFLAGS
#28832
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
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?
Specifying the
-sectcreate
linker flags in cgo LDFLAGS fails due to options blacklisting. Sample code here: https://play.golang.org/p/rLGjmbfxTI7 (does not run due to constraints of the playground).A workaround is to build with CGO_LDFLAGS_ALLOW exceptions:
Specifying
-linkmode external
is required.What did you expect to see?
No errors during the compile phase.
What did you see instead?
go build _/Users/john_mah/gitlab/lstp: invalid flag in #cgo LDFLAGS: -sectcreate
Notes
macOS developers use
-sectcreate
linker options to embed Info.plist and Launchd.plist property files into executables so that they can be used as daemons (or Privileged Helper Tools) on macOS. This can only be done at link time and needs to be done before codesigning takes place.Specifying the
-sectcreate
options in global CGO_LDFLAGS environment has the unusual side effect of emitting multiple-sectcreate
directives in the final linker statement which end up corrupting the embedded file. (Perhaps a separate bug should be filed for this)The text was updated successfully, but these errors were encountered: