diff options
author | Cherry Zhang <cherryyz@google.com> | 2020-10-12 13:44:21 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2020-10-14 21:32:26 +0000 |
commit | e4ec30965b9ca629922e83b8d335224ae4bdf062 (patch) | |
tree | 02dc7a764ab2664d586ff306187608a360f44588 /src/cmd/go/internal/load/pkg.go | |
parent | 2ec71e57323c4801bb70a8dab687991e551229f4 (diff) | |
download | go-e4ec30965b9ca629922e83b8d335224ae4bdf062.tar.gz go-e4ec30965b9ca629922e83b8d335224ae4bdf062.zip |
cmd/link: support internal linking on darwin/arm64
Add support of internal linking on darwin/arm64 (macOS).
Still incomplete. Pure Go binaries work. Cgo doesn't. TLS is not
set up when cgo is not used (as before) (so asynchronous
preemption is not enabled).
Internal linking is not enabled by default but can be requested
via -ldflags=-linkmode=internal.
Updates #38485.
Change-Id: I1e0c81b6028edcb1ac26dcdafeb9bb3f788cf732
Reviewed-on: https://go-review.googlesource.com/c/go/+/261643
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/go/internal/load/pkg.go')
-rw-r--r-- | src/cmd/go/internal/load/pkg.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go index db2434260f..f73b79d089 100644 --- a/src/cmd/go/internal/load/pkg.go +++ b/src/cmd/go/internal/load/pkg.go @@ -1948,6 +1948,10 @@ func LinkerDeps(p *Package) []string { // externalLinkingForced reports whether external linking is being // forced even for programs that do not use cgo. func externalLinkingForced(p *Package) bool { + if !cfg.BuildContext.CgoEnabled { + return false + } + // Some targets must use external linking even inside GOROOT. switch cfg.BuildContext.GOOS { case "android": @@ -1960,9 +1964,6 @@ func externalLinkingForced(p *Package) bool { } } - if !cfg.BuildContext.CgoEnabled { - return false - } // Currently build modes c-shared, pie (on systems that do not // support PIE with internal linking mode (currently all // systems: issue #18968)), plugin, and -linkshared force |