]> Cypherpunks repositories - gostls13.git/commit
cmd/link: use TOC-relative trampolines on PPC64 when needed
authorPaul E. Murphy <murp@ibm.com>
Mon, 3 May 2021 16:00:54 +0000 (11:00 -0500)
committerPaul Murphy <murp@ibm.com>
Tue, 19 Apr 2022 15:07:49 +0000 (15:07 +0000)
commitcaa46312eeca1275ce22ecf8985ca31ef8de7883
treed053d17085912f2187b090be4a7c45fe328a7c08
parente8d9fd707f4914bdd298f5dcdd14d3b6035e278b
cmd/link: use TOC-relative trampolines on PPC64 when needed

When linking a PIE binary with the internal linker, TOC relative
relocations need to be generated. Update trampolines to indirect
call using R12 to more closely match the AIX/ELFv2 regardless of
buildmode, and work with position-indepdent code.

Likewise, update the check for offseting R_CALLPOWER relocs to
make a local call. It should be checking ldr.AttrExternal, not
ldr.IsExternal. This offset should not be adjusted for external
(non-go) object files, it is handled when ELF reloc are translated
into go relocs.

And, update trampoline tests to verify these are generated correctly
and produce a working binary using -buildmode=pie on ppc64le.

Fixes #52337

Change-Id: I8a2dea06c3237bdf0e87888b56a17b6c4c99a7de
Reviewed-on: https://go-review.googlesource.com/c/go/+/400234
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/link/internal/ppc64/asm.go
src/cmd/link/link_test.go