From 9def4acb06bf9167441caa8af37e27b3cdbf8cf0 Mon Sep 17 00:00:00 2001 From: Guoqi Chen Date: Thu, 12 Mar 2026 15:34:02 +0800 Subject: cmd/link: support loading R_LARCH_GOT64_PC_{LO12, HI20} relocs on loong64 On loong64, such relocations are increasingly common when built using an "extreme" code model. To ensure future interoperability with cgo, the linker needs to be made aware of these relocations. Ref: https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc Fixes #78047. Change-Id: Ibca205ab837279c69fb243a8e8519c952e11c99e Reviewed-on: https://go-review.googlesource.com/c/go/+/753521 Reviewed-by: Cherry Mui Reviewed-by: Meidan Li LUCI-TryBot-Result: Go LUCI Reviewed-by: Carlos Amedee --- src/cmd/internal/obj/fips140.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/cmd/internal/obj') diff --git a/src/cmd/internal/obj/fips140.go b/src/cmd/internal/obj/fips140.go index b888396b1f..0e4f2a47a3 100644 --- a/src/cmd/internal/obj/fips140.go +++ b/src/cmd/internal/obj/fips140.go @@ -356,6 +356,8 @@ func (s *LSym) checkFIPSReloc(ctxt *Link, rel Reloc) { objabi.R_GOTPCREL, objabi.R_LOONG64_ADDR_LO, // used with PC-relative load objabi.R_LOONG64_ADDR_HI, // used with PC-relative load + objabi.R_LOONG64_ADDR64_LO, // used with PC-relative load + objabi.R_LOONG64_ADDR64_HI, // used with PC-relative load objabi.R_LOONG64_ADDR_PCREL20_S2, // used with PC-relative load objabi.R_LOONG64_CALL36, objabi.R_LOONG64_TLS_LE_HI, @@ -364,6 +366,8 @@ func (s *LSym) checkFIPSReloc(ctxt *Link, rel Reloc) { objabi.R_LOONG64_TLS_IE_LO, objabi.R_LOONG64_GOT_HI, objabi.R_LOONG64_GOT_LO, + objabi.R_LOONG64_GOT64_HI, + objabi.R_LOONG64_GOT64_LO, objabi.R_JMP16LOONG64, objabi.R_JMP21LOONG64, objabi.R_PCREL, -- cgit v1.3-5-g9baa