]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/link: default to external linking with cgo std packages
authorCherry Mui <cherryyz@google.com>
Tue, 21 Feb 2023 22:34:41 +0000 (17:34 -0500)
committerCherry Mui <cherryyz@google.com>
Wed, 22 Feb 2023 21:40:45 +0000 (21:40 +0000)
Previously, when a program depends on cgo packages in the standard
library (e.g. net, os/user) but not otherwise use cgo, we default
to internal linking mode. As we shipped pre-built cgo-using packages
in Go distributions, we don't require a C compiler to build those
packages. Then, by using internal linking we can link programs
using those packages without requiring a C toolchain.

As of Go 1.20, we stopped shipping those pre-built packages. If a
user doesn't have a C toolchain, they will use the non-cgo version
of the package. If they have a C toolchain, they can get cgo-using
packages but they can link with the external linker as well. So
there is no strong need to be able to link the cgo version of the
packages without a C toolchain. This CL makes it default to
external linking mode.

Fixes #58619.
Fixes #58620.

Change-Id: I62d3744c2b82ce734813c0e303e417d85dd29868
Reviewed-on: https://go-review.googlesource.com/c/go/+/470298
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/lib.go

index d96f13225642766e9bbebc3ae589d897e5b60fa4..b8bed27858be2b7516702105cab68cd8c55a219f 100644 (file)
@@ -1118,9 +1118,6 @@ var hostobj []Hostobj
 var internalpkg = []string{
        "crypto/internal/boring",
        "crypto/internal/boring/syso",
-       "crypto/x509",
-       "net",
-       "os/user",
        "runtime/cgo",
        "runtime/race",
        "runtime/race/internal/amd64v1",