aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2026-01-30 18:42:27 -0800
committerGopher Robot <gobot@golang.org>2026-02-04 11:28:03 -0800
commitbd1b41eb8131a503a1a8d2fc41d3e79bce159468 (patch)
tree480aa30270d7c4a6de57a2d91e2c72446db70f46 /src/runtime
parent01299a31c26b730785ac497da2ef7c593947d5d7 (diff)
downloadgo-bd1b41eb8131a503a1a8d2fc41d3e79bce159468.tar.xz
reflect, runtime: adjust user-created GCData on AIX
On AIX the runtime adjusts the GCData field in getGCMaskOnDemand to account for the AIX dynamic loader moving the data section. That works fine for statically generated types, but it breaks user generated types. The user generated type will have a normal, correct, pointer, and adjusting the pointer will make it point elsewhere. This all happens to work OK when doing an external link, because in that case we do have dynamic relocs and there is no adjustment. But it fails with an internal link. This CL fixes the problem by applying a reverse adjustment to user generated types, so that the adjustment winds up with the original pointer value. Change-Id: Ibf3199b9ffb36e79af134fbed41db2853297de74 Reviewed-on: https://go-review.googlesource.com/c/go/+/740800 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/runtime1.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go
index 9b1dd585ca..d5bce17563 100644
--- a/src/runtime/runtime1.go
+++ b/src/runtime/runtime1.go
@@ -732,6 +732,15 @@ func reflect_addReflectOff(ptr unsafe.Pointer) int32 {
return id
}
+// reflect_adjustAIXGCDataForRuntime takes a type.GCData address and returns
+// the new address to use. This is only called on AIX.
+// See getGCMaskOnDemand.
+//
+//go:linkname reflect_adjustAIXGCDataForRuntime reflect.adjustAIXGCDataForRuntime
+func reflect_adjustAIXGCDataForRuntime(addr *byte) *byte {
+ return (*byte)(add(unsafe.Pointer(addr), aixStaticDataBase-firstmoduledata.data))
+}
+
//go:linkname fips_getIndicator crypto/internal/fips140.getIndicator
func fips_getIndicator() uint8 {
return getg().fipsIndicator