aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-12-21 12:43:54 -0500
committerGopher Robot <gobot@golang.org>2022-12-28 16:57:28 +0000
commit24963e5c06e8b90391f46f1bcf825c72342fa0eb (patch)
treeee619ccd3b229f02a4d8e13af8053e202ca78277
parent5758a14e431c88996a8061435e8381a26af0a214 (diff)
downloadgo-24963e5c06e8b90391f46f1bcf825c72342fa0eb.tar.gz
go-24963e5c06e8b90391f46f1bcf825c72342fa0eb.zip
[release-branch.go1.19] cmd/link: recognize the new R_LARCH_32_PCREL type on loong64
This is a minimum backport of CL 420983 without an API change in debug/elf. Original CL description: Due to the latest binutils change [1], at least for certain 32-bit relocs in .eh_frame section, this new type of relocation record is emitted, leading to breakage on systems with bleeding-edge toolchain when trying to link with object(s) with such new-style relocs. Simply treating it the same as the existing reloc types seems enough. Updates #54222. Fixes #57444. [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f09482a8747b6fd4c2d59a6a64677d3a3fe1e092 Change-Id: Idd86294a11c1d13b88acbca59e537656a57d8109 Reviewed-on: https://go-review.googlesource.com/c/go/+/458836 Reviewed-by: WANG Xuerui <git@xen0n.name> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com>
-rw-r--r--src/cmd/link/internal/loadelf/ldelf.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/link/internal/loadelf/ldelf.go b/src/cmd/link/internal/loadelf/ldelf.go
index f5b7907675..d2d54efb30 100644
--- a/src/cmd/link/internal/loadelf/ldelf.go
+++ b/src/cmd/link/internal/loadelf/ldelf.go
@@ -1002,7 +1002,8 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
LOONG64 | uint32(elf.R_LARCH_MARK_LA)<<16,
LOONG64 | uint32(elf.R_LARCH_SOP_POP_32_S_0_10_10_16_S2)<<16,
LOONG64 | uint32(elf.R_LARCH_64)<<16,
- LOONG64 | uint32(elf.R_LARCH_MARK_PCREL)<<16:
+ LOONG64 | uint32(elf.R_LARCH_MARK_PCREL)<<16,
+ LOONG64 | 99<<16: // R_LARCH_32_PCREL
return 4, 4, nil
case S390X | uint32(elf.R_390_8)<<16: