aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/loadelf
diff options
context:
space:
mode:
authorPaul E. Murphy <murp@ibm.com>2022-06-13 10:59:31 -0500
committerGopher Robot <gobot@golang.org>2022-09-15 21:11:05 +0000
commit7fda98a8d90139fed07d7f8ca80d248a5cbc1e93 (patch)
treee73a3f56c03d149f67a8eef71741734fa6ea1418 /src/cmd/link/internal/loadelf
parente7a2014fac885392e14205c93fff3fd8db84fa8d (diff)
downloadgo-7fda98a8d90139fed07d7f8ca80d248a5cbc1e93.tar.xz
cmd/link: support -fno-plt compiled gcc objects on ppc64le
This is the initial trivial implemenation. Further improvements can be made for local calls. A test is added, but the -fno-plt option is ignored by gcc if binutils does not support inline plt relocations, so the test is effectively skipped on such hosts. Fixes #53345 Change-Id: Ibf31c26b1a8551c942b21019df8782c00b7a563e Reviewed-on: https://go-review.googlesource.com/c/go/+/412714 Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Jenny Rakoczy <jenny@golang.org> Auto-Submit: Jenny Rakoczy <jenny@golang.org> Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Diffstat (limited to 'src/cmd/link/internal/loadelf')
-rw-r--r--src/cmd/link/internal/loadelf/ldelf.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/cmd/link/internal/loadelf/ldelf.go b/src/cmd/link/internal/loadelf/ldelf.go
index 6014caca09..74f7cb15a0 100644
--- a/src/cmd/link/internal/loadelf/ldelf.go
+++ b/src/cmd/link/internal/loadelf/ldelf.go
@@ -1108,8 +1108,19 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
PPC64 | uint32(elf.R_PPC64_TOC16_LO_DS)<<16,
PPC64 | uint32(elf.R_PPC64_REL16_LO)<<16,
PPC64 | uint32(elf.R_PPC64_REL16_HI)<<16,
- PPC64 | uint32(elf.R_PPC64_REL16_HA)<<16:
+ PPC64 | uint32(elf.R_PPC64_REL16_HA)<<16,
+ PPC64 | uint32(elf.R_PPC64_PLT16_HA)<<16,
+ PPC64 | uint32(elf.R_PPC64_PLT16_LO_DS)<<16:
return 2, 4, nil
+
+ // PPC64 inline PLT sequence hint relocations (-fno-plt)
+ // These are informational annotations to assist linker optimizations.
+ case PPC64 | uint32(elf.R_PPC64_PLTSEQ)<<16,
+ PPC64 | uint32(elf.R_PPC64_PLTCALL)<<16,
+ PPC64 | uint32(elf.R_PPC64_PLTCALL_NOTOC)<<16,
+ PPC64 | uint32(elf.R_PPC64_PLTSEQ_NOTOC)<<16:
+ return 0, 0, nil
+
}
}