aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/data.go
diff options
context:
space:
mode:
authorPaul E. Murphy <murp@ibm.com>2021-07-14 14:09:27 -0500
committerLynn Boger <laboger@linux.vnet.ibm.com>2021-11-05 19:14:22 +0000
commitfa16efb8358e0cb23e285803075764abbdcffe5e (patch)
tree48840800c98379e5fb0c286723c1b300297e48d7 /src/cmd/link/internal/ld/data.go
parent93bab8a2f918afa8417f7b46da69c21d643de880 (diff)
downloadgo-fa16efb8358e0cb23e285803075764abbdcffe5e.tar.xz
cmd/link: enable internal linking of PIE binaries on ppc64le
The amd64/arm64 relocation processing is used as a template and updated for ppc64le. This requires updating the TOC relocation handling code to support linux type TOC relocations too (note, AIX uses TOC-indirect accesses). Noteably, the shared flag of go functions is used as a proxy for the local entry point offset encoded in elf objects. Functions in go ppc64le shared objects always[1] insert 2 instructions to regenerate the TOC pointer. [1] excepting a couple special runtime functions, see preprocess in obj9.go for specific details of this behavior. Change-Id: I3646e6dc8a0a0ffe712771a976983315eae5c418 Reviewed-on: https://go-review.googlesource.com/c/go/+/352829 Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Diffstat (limited to 'src/cmd/link/internal/ld/data.go')
-rw-r--r--src/cmd/link/internal/ld/data.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go
index 0513a0d10b..4d85977d43 100644
--- a/src/cmd/link/internal/ld/data.go
+++ b/src/cmd/link/internal/ld/data.go
@@ -227,6 +227,8 @@ func (st *relocSymState) relocsym(s loader.Sym, P []byte) {
// DWARF info between the compiler and linker.
continue
}
+ } else if target.IsPPC64() && target.IsPIE() && ldr.SymName(rs) == ".TOC." {
+ // This is a TOC relative relocation generated from a go object. It is safe to resolve.
} else {
st.err.errorUnresolved(ldr, s, rs)
continue