diff options
author | Than McIntosh <thanm@google.com> | 2023-03-10 10:29:38 -0500 |
---|---|---|
committer | Than McIntosh <thanm@google.com> | 2023-03-14 13:17:46 +0000 |
commit | 035db07d7c5f1b90ebc9bae03cab694685acebb8 (patch) | |
tree | 2adb1f902e46d03873654b503451fe3cf9e29e9b /src/cmd/go/testdata/script/README | |
parent | b37c0602cdc9b7f13b3d539663e68b12f10b44b1 (diff) | |
download | go-035db07d7c5f1b90ebc9bae03cab694685acebb8.tar.gz go-035db07d7c5f1b90ebc9bae03cab694685acebb8.zip |
cmd/go,cmd/link: prefer external linking when strange cgo flags seen
This patch changes the Go command to examine the set of compiler
flags feeding into the C compiler when packages that use cgo are built.
If any of a specific set of strange/dangerous flags are in use,
then the Go command generates a token file ("preferlinkext") and
embeds it into the compiled package's archive.
When the Go linker reads the archives of the packages feeding into the
link and detects a "preferlinkext" token, it will then use external
linking for the program by default (although this default can be
overridden with an explicit "-linkmode" flag).
The intent here is to avoid having to teach the Go linker's host object
reader to grok/understand the various odd symbols/sections/types that
can result from boutique flag use, but rather to just boot the objects
in question over to the C linker instead.
Updates #58619.
Updates #58620.
Updates #58848.
Change-Id: I56382dd305de8dac3841a7a7e664277826061eaa
Reviewed-on: https://go-review.googlesource.com/c/go/+/475375
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/testdata/script/README')
-rw-r--r-- | src/cmd/go/testdata/script/README | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cmd/go/testdata/script/README b/src/cmd/go/testdata/script/README index 7b747994c6..349ba972fb 100644 --- a/src/cmd/go/testdata/script/README +++ b/src/cmd/go/testdata/script/README @@ -382,6 +382,8 @@ The available conditions are: $WORK filesystem is case-sensitive [cgo] host CGO_ENABLED +[cgolinkext] + platform requires external linking for cgo [compiler:*] runtime.Compiler == <suffix> [cross] |