Skip to content

Commit 2c4f389

Browse files
pmurlaboger
authored andcommitted
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>
1 parent fb84e99 commit 2c4f389

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/cmd/dist/test.go

-5
Original file line numberDiff line numberDiff line change
@@ -984,11 +984,6 @@ func (t *tester) internalLink() bool {
984984
// linkmode=internal fails on dragonfly since errno is a TLS relocation.
985985
return false
986986
}
987-
if gohostarch == "ppc64le" {
988-
// linkmode=internal fails on ppc64le because cmd/link doesn't
989-
// handle the TOC correctly (issue 15409).
990-
return false
991-
}
992987
if goos == "android" {
993988
return false
994989
}

src/cmd/link/internal/ld/config.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
195195

196196
// Internally linking cgo is incomplete on some architectures.
197197
// https://golang.org/issue/14449
198-
// https://golang.org/issue/21961
199-
if iscgo && ctxt.Arch.InFamily(sys.MIPS64, sys.MIPS, sys.PPC64, sys.RISCV64) {
198+
if iscgo && ctxt.Arch.InFamily(sys.MIPS64, sys.MIPS, sys.RISCV64) {
200199
return true, buildcfg.GOARCH + " does not support internal cgo"
201200
}
202201
if iscgo && (buildcfg.GOOS == "android" || buildcfg.GOOS == "dragonfly") {
@@ -209,12 +208,9 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
209208
// windows/arm64 internal linking is not implemented.
210209
return true, buildcfg.GOOS + "/" + buildcfg.GOARCH + " does not support internal cgo"
211210
}
212-
213-
// When the race flag is set, the LLVM tsan relocatable file is linked
214-
// into the final binary, which means external linking is required because
215-
// internal linking does not support it.
216-
if *flagRace && ctxt.Arch.InFamily(sys.PPC64) {
217-
return true, "race on " + buildcfg.GOARCH
211+
if iscgo && ctxt.Arch == sys.ArchPPC64 {
212+
// Big Endian PPC64 cgo internal linking is not implemented for aix or linux.
213+
return true, buildcfg.GOOS + " does not support internal cgo"
218214
}
219215

220216
// Some build modes require work the internal linker cannot do (yet).

0 commit comments

Comments
 (0)