1
0
mirror of https://github.com/golang/go synced 2024-11-26 19:51:17 -07:00

cmd/link: enable internal linking by default on darwin/arm64

With previous CLs, internal linking without cgo should work well.
Enable it by default. And stop always requiring cgo.

Enable tests that were previously disabled due to the lack of
internal linking.

Updates #38485.

Change-Id: I45125b9c263fd21d6847aa6b14ecaea3a2989b29
Reviewed-on: https://go-review.googlesource.com/c/go/+/265121
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Cherry Zhang 2020-10-24 20:58:38 -04:00
parent 7c8d82e92b
commit b85c2dd56c
7 changed files with 3 additions and 22 deletions

View File

@ -1964,10 +1964,6 @@ func externalLinkingForced(p *Package) bool {
}
case "ios":
return true
case "darwin":
if cfg.BuildContext.GOARCH == "arm64" {
return true
}
}
// Currently build modes c-shared, pie (on systems that do not

View File

@ -39,7 +39,7 @@ func MustLinkExternal(goos, goarch string) bool {
if goarch != "arm64" {
return true
}
case "darwin", "ios":
case "ios":
if goarch == "arm64" {
return true
}

View File

@ -185,7 +185,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
}()
}
if sys.MustLinkExternal(objabi.GOOS, objabi.GOARCH) && !(objabi.GOOS == "darwin" && objabi.GOARCH == "arm64") { // XXX allow internal linking for darwin/arm64 but not change the default
if sys.MustLinkExternal(objabi.GOOS, objabi.GOARCH) {
return true, fmt.Sprintf("%s/%s requires external linking", objabi.GOOS, objabi.GOARCH)
}
@ -261,8 +261,6 @@ func determineLinkMode(ctxt *Link) {
default:
if extNeeded || (iscgo && externalobj) {
ctxt.LinkMode = LinkExternal
} else if ctxt.IsDarwin() && ctxt.IsARM64() {
ctxt.LinkMode = LinkExternal // default to external linking for now
} else {
ctxt.LinkMode = LinkInternal
}

View File

@ -15,11 +15,6 @@ func canInternalLink() bool {
switch runtime.GOOS {
case "aix":
return false
case "darwin":
switch runtime.GOARCH {
case "arm64":
return false
}
case "dragonfly":
return false
case "freebsd":

View File

@ -201,7 +201,7 @@ func CanInternalLink() bool {
if runtime.GOARCH != "arm64" {
return false
}
case "darwin", "ios":
case "ios":
if runtime.GOARCH == "arm64" {
return false
}

View File

@ -1,10 +1,6 @@
// run
// +build !nacl,!js
// +build !darwin !arm64
// Skip on darwin/arm64 as it requires external linking, which brings in
// cgo, causing deadlock detection not working.
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style

View File

@ -1,10 +1,6 @@
// run
// +build !nacl,!js
// +build !darwin !arm64
// Skip on darwin/arm64 as it requires external linking, which brings in
// cgo, causing deadlock detection not working.
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style