1
0
mirror of https://github.com/golang/go synced 2024-11-17 14:04:48 -07:00

cmd/link: enable internal linker in more cases for ppc64le

The internal linker is capable of linking the ppc64le linux
race detector and approved cgo packages.

Likewise, ppc64/linux and ppc64/aix do not support the race
detector. Thus, extra code to enforce external linking when
using the race detector on ppc64/ppc64le can be removed
entirely.

Fixes #21961

Change-Id: I10db14f65ee616ee3291e17409e8333e3af7d4df
Reviewed-on: https://go-review.googlesource.com/c/go/+/304459
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Paul E. Murphy 2021-03-23 16:17:00 -05:00 committed by Lynn Boger
parent fb84e99eb7
commit 2c4f389c02
2 changed files with 4 additions and 13 deletions

View File

@ -984,11 +984,6 @@ func (t *tester) internalLink() bool {
// linkmode=internal fails on dragonfly since errno is a TLS relocation. // linkmode=internal fails on dragonfly since errno is a TLS relocation.
return false return false
} }
if gohostarch == "ppc64le" {
// linkmode=internal fails on ppc64le because cmd/link doesn't
// handle the TOC correctly (issue 15409).
return false
}
if goos == "android" { if goos == "android" {
return false return false
} }

View File

@ -195,8 +195,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
// Internally linking cgo is incomplete on some architectures. // Internally linking cgo is incomplete on some architectures.
// https://golang.org/issue/14449 // https://golang.org/issue/14449
// https://golang.org/issue/21961 if iscgo && ctxt.Arch.InFamily(sys.MIPS64, sys.MIPS, sys.RISCV64) {
if iscgo && ctxt.Arch.InFamily(sys.MIPS64, sys.MIPS, sys.PPC64, sys.RISCV64) {
return true, buildcfg.GOARCH + " does not support internal cgo" return true, buildcfg.GOARCH + " does not support internal cgo"
} }
if iscgo && (buildcfg.GOOS == "android" || buildcfg.GOOS == "dragonfly") { if iscgo && (buildcfg.GOOS == "android" || buildcfg.GOOS == "dragonfly") {
@ -209,12 +208,9 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
// windows/arm64 internal linking is not implemented. // windows/arm64 internal linking is not implemented.
return true, buildcfg.GOOS + "/" + buildcfg.GOARCH + " does not support internal cgo" return true, buildcfg.GOOS + "/" + buildcfg.GOARCH + " does not support internal cgo"
} }
if iscgo && ctxt.Arch == sys.ArchPPC64 {
// When the race flag is set, the LLVM tsan relocatable file is linked // Big Endian PPC64 cgo internal linking is not implemented for aix or linux.
// into the final binary, which means external linking is required because return true, buildcfg.GOOS + " does not support internal cgo"
// internal linking does not support it.
if *flagRace && ctxt.Arch.InFamily(sys.PPC64) {
return true, "race on " + buildcfg.GOARCH
} }
// Some build modes require work the internal linker cannot do (yet). // Some build modes require work the internal linker cannot do (yet).