From fa16efb8358e0cb23e285803075764abbdcffe5e Mon Sep 17 00:00:00 2001 From: "Paul E. Murphy" Date: Wed, 14 Jul 2021 14:09:27 -0500 Subject: 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 Reviewed-by: Cherry Mui TryBot-Result: Go Bot Trust: Lynn Boger --- src/debug/elf/elf.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/debug/elf') diff --git a/src/debug/elf/elf.go b/src/debug/elf/elf.go index 9f8399d4d3..4c51bc4de2 100644 --- a/src/debug/elf/elf.go +++ b/src/debug/elf/elf.go @@ -2349,6 +2349,7 @@ const ( R_PPC64_GOT16_HI R_PPC64 = 16 // R_POWERPC_GOT16_HI R_PPC64_GOT16_HA R_PPC64 = 17 // R_POWERPC_GOT16_HA R_PPC64_JMP_SLOT R_PPC64 = 21 // R_POWERPC_JMP_SLOT + R_PPC64_RELATIVE R_PPC64 = 22 // R_POWERPC_RELATIVE R_PPC64_REL32 R_PPC64 = 26 // R_POWERPC_REL32 R_PPC64_ADDR64 R_PPC64 = 38 R_PPC64_ADDR16_HIGHER R_PPC64 = 39 @@ -2457,6 +2458,7 @@ var rppc64Strings = []intName{ {16, "R_PPC64_GOT16_HI"}, {17, "R_PPC64_GOT16_HA"}, {21, "R_PPC64_JMP_SLOT"}, + {22, "R_PPC64_RELATIVE"}, {26, "R_PPC64_REL32"}, {38, "R_PPC64_ADDR64"}, {39, "R_PPC64_ADDR16_HIGHER"}, -- cgit v1.3