]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: enable internal linking by default on darwin/arm64
authorCherry Zhang <cherryyz@google.com>
Sun, 25 Oct 2020 00:58:38 +0000 (20:58 -0400)
committerCherry Zhang <cherryyz@google.com>
Wed, 28 Oct 2020 14:25:56 +0000 (14:25 +0000)
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>
src/cmd/go/internal/load/pkg.go
src/cmd/internal/sys/supported.go
src/cmd/link/internal/ld/config.go
src/cmd/nm/nm_cgo_test.go
src/internal/testenv/testenv.go
test/fixedbugs/bug429_run.go
test/fixedbugs/issue21576.go

index 4c541b9017725c43a79943d502ca36f0d54ccf88..ff744ee9fa2a509b12167ee87ec97f38a653c72a 100644 (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
index 1d813bbb476a21753cc5788ed4dd00c9c05b90c2..afc81381fdf08ce3043dc48282523ac5abd4d571 100644 (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
                }
index 54a94cebbafd24e45c510decf360208b2d353e7f..0cb3cc25c06408b96ee3acbddda80e11553623e7 100644 (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
                        }
index 58f2c24908d0e04066abdcf36195a3f3fac38522..9a257e0ed2eced69d18e9e6385aafe3d6286528f 100644 (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":
index 0ee6355ee38c443cd6ad4490fb31385fb0fc6bce..dff68869bd26bd5c20f2cc54de0cd6c79229981d 100644 (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
                }
index 60cc5b62de8b6f91e27c127f011295ec5c545803..c2bb1b85cbe576d9215961f3e5806b7ae9eec193 100644 (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
index 3797a8c9ba531472ad4c2764963862f1ef85e5d7..ae6161ccf52d3926a8030607f231e3b7511900fb 100644 (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