From bdd4c38ce3c568efaf274281c40ecc6288c655a6 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 23 Feb 2026 10:56:29 +0100 Subject: runtime/cgo: fix setg_gcc call on aix/ppc64 aix/ppc64 uses function descriptors instead of function pointers. CL 708235 assumed the latter, which caused a crash when calling setg_gcc. Fix the call by dereferencing the function descriptor to get the entry point and TOC. Tested using gomote, as LUCI builders still don't support aix/ppc64. Fixes #77753. Change-Id: I6a0a6e971341f18f400c044f47b0daa42b93599e Reviewed-on: https://go-review.googlesource.com/c/go/+/747960 Run-TryBot: Paul Murphy Reviewed-by: Paul Murphy TryBot-Result: Gopher Robot Reviewed-by: Mark Freeman LUCI-TryBot-Result: Go LUCI Reviewed-by: David Chase --- src/runtime/cgo/gcc_aix_ppc64.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/runtime') diff --git a/src/runtime/cgo/gcc_aix_ppc64.S b/src/runtime/cgo/gcc_aix_ppc64.S index 740bf5dbef..616d4c5ffc 100644 --- a/src/runtime/cgo/gcc_aix_ppc64.S +++ b/src/runtime/cgo/gcc_aix_ppc64.S @@ -40,8 +40,11 @@ crosscall1: mr 30, 5 // Call setg_gcc(g) + // Function pointers are function descriptors. + // Dereference setg_gcc to get the entry point and TOC. mr 3, 5 // arg g - mr 12, 4 // setg_gcc + ld 12, 0(4) // load entry point from function descriptor + ld 2, 8(4) // load TOC from function descriptor mtctr 12 bctrl -- cgit v1.3-5-g45d5