]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link,cmd/internal/obj/ppc64: enable PCrel on power10/ppc64/linux
authorPaul E. Murphy <murp@ibm.com>
Mon, 17 Apr 2023 14:25:45 +0000 (09:25 -0500)
committerPaul Murphy <murp@ibm.com>
Fri, 21 Apr 2023 16:09:34 +0000 (16:09 +0000)
A CI machine has been set up to verify GOPPC64=power10 on ppc64/linux.

This should be sufficient to verify the PCrel relocation support works
for BE.

Note, power10/ppc64/linux is an oddball case. Today, it can only link
internally. Furthermore, all PCrel relocs are resolved at link time,
so it works despite ELFv1 having no official support for PCrel relocs
today.

Change-Id: Ibf79df69406ec6f9352c9d7d941ad946dba74e73
Reviewed-on: https://go-review.googlesource.com/c/go/+/485075
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/internal/obj/ppc64/asm9.go
src/cmd/link/internal/ppc64/asm.go

index 109112721057d9cadb394d3762d51e4b96f369bc..1575bb66d038436d0c6124e580d4365b92706931 100644 (file)
@@ -1300,9 +1300,8 @@ func opset(a, b0 obj.As) {
 
 // Build the opcode table
 func buildop(ctxt *obj.Link) {
-       // PC-rel relocation support is available only for targets which support
-       // ELFv2 1.5 (only power10/ppc64le/linux today).
-       pfxEnabled = buildcfg.GOPPC64 >= 10 && buildcfg.GOOS == "linux" && buildcfg.GOARCH == "ppc64le"
+       // Limit PC-relative prefix instruction usage to supported and tested targets.
+       pfxEnabled = buildcfg.GOPPC64 >= 10 && buildcfg.GOOS == "linux"
        cfg := fmt.Sprintf("power%d/%s/%s", buildcfg.GOPPC64, buildcfg.GOARCH, buildcfg.GOOS)
        if cfg == buildOpCfg {
                // Already initialized to correct OS/cpu; stop now.
index 333411a53d9cd89f2a6905f1e9b5bcf9764bedab..445180bb791d80ef880ae8609ec2db86faa4057a 100644 (file)
@@ -45,8 +45,8 @@ import (
        "strings"
 )
 
-// The build configuration supports PC-relative instructions and relocations.
-var hasPCrel = buildcfg.GOPPC64 >= 10 && buildcfg.GOOS == "linux" && buildcfg.GOARCH == "ppc64le"
+// The build configuration supports PC-relative instructions and relocations (limited to tested targets).
+var hasPCrel = buildcfg.GOPPC64 >= 10 && buildcfg.GOOS == "linux"
 
 func genpltstub(ctxt *ld.Link, ldr *loader.Loader, r loader.Reloc, s loader.Sym) (sym loader.Sym, firstUse bool) {
        // The ppc64 ABI PLT has similar concepts to other