1
0
mirror of https://github.com/golang/go synced 2024-11-16 21:34:52 -07:00

cmd/link/internal/ppc64: fix export of R_DWARFSECREF to ELF on ppc64

Today, external linking is not supported on any ppc64 ELF target, but
soon openbsd will be enabled with external linking support.

This relocation does not require additional endian specific fixups
like most other PPC64 Go relocation types.

I discovered this during an experiment to support external linking
on ppc64/linux.

Change-Id: I0b12b6172c7ba08df1c8cf024b4aa5e7ee76d0c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/492618
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Paul E. Murphy 2023-05-04 13:14:52 -05:00 committed by Paul Murphy
parent d8ab19b2f2
commit f3034bed72

View File

@ -729,7 +729,7 @@ func xcoffreloc1(arch *sys.Arch, out *ld.OutBuf, ldr *loader.Loader, s loader.Sy
func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym, r loader.ExtReloc, ri int, sectoff int64) bool {
// Beware that bit0~bit15 start from the third byte of an instruction in Big-Endian machines.
rt := r.Type
if rt == objabi.R_ADDR || rt == objabi.R_POWER_TLS || rt == objabi.R_CALLPOWER {
if rt == objabi.R_ADDR || rt == objabi.R_POWER_TLS || rt == objabi.R_CALLPOWER || rt == objabi.R_DWARFSECREF {
} else {
if ctxt.Arch.ByteOrder == binary.BigEndian {
sectoff += 2