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

cmd/link,cmd/internal/obj/ppc64: enable PCrel on power10/ppc64/linux

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>
This commit is contained in:
Paul E. Murphy 2023-04-17 09:25:45 -05:00 committed by Paul Murphy
parent 9027e5d2b4
commit ccb8db88c5
2 changed files with 4 additions and 5 deletions

View 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.

View 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