]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] 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)
committerHeschi Kreinick <heschi@google.com>
Wed, 6 Jul 2022 20:55:56 +0000 (20:55 +0000)
commit3a7cec27738c51347f4e5a466410a0b2089391b7
tree163cb518c6ec7ad7f6b4aef4da573b98b39a9163
parentb80ae102217ad4fefb7e72e060500f42d252a50a
[release-branch.go1.18] 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 #53107

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>
Reviewed-on: https://go-review.googlesource.com/c/go/+/409075
Run-TryBot: Cherry Mui <cherryyz@google.com>
src/cmd/link/internal/ppc64/asm.go
src/cmd/link/link_test.go