]> Cypherpunks repositories - gostls13.git/commit
cmd/link: establish dependable package initialization order
authorKeith Randall <khr@golang.org>
Fri, 13 Jan 2023 04:25:39 +0000 (20:25 -0800)
committerKeith Randall <khr@golang.org>
Fri, 3 Mar 2023 23:11:37 +0000 (23:11 +0000)
commitce2a609909d9de3391a99a00fe140506f724f933
tree73fcbd68f8148f993ca3717ea5fd3bec224c7f56
parentcd6d225bd30608544ecf4a3e5a7aa1d0607a66db
cmd/link: establish dependable package initialization order

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: I1e4d3878ebe6e8953527aedb730824971d722cac
Reviewed-on: https://go-review.googlesource.com/c/go/+/462035
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
14 files changed:
src/cmd/compile/internal/pkginit/init.go
src/cmd/internal/objabi/reloctype.go
src/cmd/link/internal/ld/deadcode.go
src/cmd/link/internal/ld/heap.go
src/cmd/link/internal/ld/inittask.go [new file with mode: 0644]
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/main.go
src/cmd/link/internal/ld/symtab.go
src/plugin/plugin_dlopen.go
src/runtime/plugin.go
src/runtime/proc.go
src/runtime/symtab.go
test/fixedbugs/issue31636.out
test/noinit.go