]> Cypherpunks.ru 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, 14 Apr 2023 16:55:22 +0000 (16:55 +0000)
commit2b92c39fe08101ed8c9f032d577df4cc882d08d7
tree1446e0a68fa6fb81fdd141a241e8b818e6343151
parentd4bcfe4e834da1d31b7071e83eb045e089271175
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 <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