aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2026-01-30 19:06:19 -0800
committerGopher Robot <gobot@golang.org>2026-02-06 15:30:41 -0800
commit9fd5a5fa7d9d629ded8d4685dcc5984268258edb (patch)
tree007004fcf954f1d95c887938637b3e628337c783 /src/runtime
parent4fe1203111eeda8a38af4f2a4208e4d4de720c0d (diff)
downloadgo-9fd5a5fa7d9d629ded8d4685dcc5984268258edb.tar.xz
cmd/link: use correct alignment for type descriptors on AIX
CL 724261 changed the linker to put all type descriptors that are used for typelinks in a single list. This caused trouble on AIX when linking externally, because the AIX linker aligns symbols individually, rather than honoring the layout of the object file generated by the internal linker. I fixed internal linking problems with CL 740220, but that just made things worse for the external linker. This CL rolls back 740220, and adds commentary. With this CL we force a smaller alignment for type descriptors, use the same alignment for runtime.types and type:*, and use a consistent size for runtime.types in all cases. With this change all the type descriptor related code passes again on AIX, except for the new TestTypePlacement test which I will fix in a followup CL. Fixes #77400 Change-Id: I9f25847eb0588001cb4ce453f211a655400d6a59 Reviewed-on: https://go-review.googlesource.com/c/go/+/740820 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/type.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/type.go b/src/runtime/type.go
index 78018fd9a8..82ac5120bb 100644
--- a/src/runtime/type.go
+++ b/src/runtime/type.go
@@ -520,6 +520,11 @@ func moduleTypelinks(md *moduledata) []*_type {
// We have to increment by 1 to match the increment done in
// cmd/link/internal/data.go createRelroSect in allocateDataSections.
+ //
+ // We don't do that increment on AIX, but on AIX we need to adjust
+ // for the fact that the runtime.types symbol has a size of 8,
+ // and the type descriptors will follow that. This increment,
+ // followed by the forced alignment to 8, will do that.
td++
etypedesc := md.types + md.typedesclen
@@ -528,6 +533,9 @@ func moduleTypelinks(md *moduledata) []*_type {
// 0x20 does not make sense.
if GOARCH == "arm" {
td = alignUp(td, 0x8)
+ } else if GOOS == "aix" {
+ // The alignment of 8 is forced in the linker on AIX.
+ td = alignUp(td, 0x8)
} else {
td = alignUp(td, 0x20)
}