From 2b92c39fe08101ed8c9f032d577df4cc882d08d7 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Thu, 12 Jan 2023 20:25:39 -0800 Subject: cmd/link: establish dependable package initialization order (This is a retry of CL 462035 which was reverted at 474976. The only change from that CL is the aix fix SRODATA->SNOPTRDATA at inittask.go:141) As described here: https://github.com/golang/go/issues/31636#issuecomment-493271830 "Find the lexically earliest package that is not initialized yet, but has had all its dependencies initialized, initialize that package, and repeat." Simplify the runtime a bit, by just computing the ordering required in the linker and giving a list to the runtime. Update #31636 Fixes #57411 RELNOTE=yes Change-Id: I28c09451d6aa677d7394c179d23c2c02c503fc56 Reviewed-on: https://go-review.googlesource.com/c/go/+/478916 Reviewed-by: Than McIntosh Reviewed-by: Cherry Mui Run-TryBot: Keith Randall TryBot-Result: Gopher Robot --- test/fixedbugs/issue31636.out | 4 ++-- test/noinit.go | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/fixedbugs/issue31636.out b/test/fixedbugs/issue31636.out index e274b2bb10..de980441c3 100644 --- a/test/fixedbugs/issue31636.out +++ b/test/fixedbugs/issue31636.out @@ -1,3 +1,3 @@ -c -b a +b +c diff --git a/test/noinit.go b/test/noinit.go index 505467cf8f..1496b27248 100644 --- a/test/noinit.go +++ b/test/noinit.go @@ -328,9 +328,8 @@ func init() { // Actual test: check for init funcs in runtime data structures. type initTask struct { - state uintptr - ndeps uintptr - nfns uintptr + state uint32 + nfns uint32 } //go:linkname main_inittask main..inittask -- cgit v1.2.1