From 2c5b1746164581c7393a7a7f7ba796e823af0248 Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Wed, 3 Aug 2022 19:43:49 +0800 Subject: [PATCH] cmd/link: recognize the new R_LARCH_32_PCREL type on loong64 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. Fixes #54222 [1]: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f09482a8747b6fd4c2d59a6a64677d3a3fe1e092 Change-Id: I876d6711d5d4a674bead37e57f9503f1622d1136 Reviewed-on: https://go-review.googlesource.com/c/go/+/420983 Run-TryBot: Dmitri Shuralyov Reviewed-by: abner chenc Auto-Submit: Dmitri Shuralyov Reviewed-by: Cherry Mui TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov --- src/cmd/link/internal/loadelf/ldelf.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/link/internal/loadelf/ldelf.go b/src/cmd/link/internal/loadelf/ldelf.go index f5b7907675..6014caca09 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 | uint32(elf.R_LARCH_32_PCREL)<<16: return 4, 4, nil case S390X | uint32(elf.R_390_8)<<16: