]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: avoid staticinit dependency with sigsetAllExiting
authorMatthew Dempsky <mdempsky@google.com>
Wed, 11 May 2022 19:44:06 +0000 (12:44 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 11 Sep 2023 20:10:52 +0000 (20:10 +0000)
commit1cdabf0c8b1297a1b82fda975f9313f69b77b262
tree68cc35c1c6d8662899ea4c2f04800061d0c3189b
parent3556d3b9bfe3ebfc8cd159464e46574e3de8fe7c
runtime: avoid staticinit dependency with sigsetAllExiting

Currently, package runtime runs `osinit` before dynamic initialization
of package-scope variables; but on GOOS=linux, `osinit` involves
mutating `sigsetAllExiting`.

This currently works because cmd/compile and gccgo have
non-spec-conforming optimizations that statically initialize
`sigsetAllExiting`, but disabling that optimization causes
`sigsetAllExiting` to be dynamically initialized instead. This in turn
causes the mutations in `osinit` to get lost.

This CL moves the initialization of `sigsetAllExiting` from `osinit`
into its initialization expression, and then removes the special case
for continuing to perform the static-initialization optimization for
package runtime.

Updates #51913.

Change-Id: I3be31454277c103372c9701d227dc774b2311dad
Reviewed-on: https://go-review.googlesource.com/c/go/+/405549
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/runtime/os_linux.go
src/runtime/signal_unix.go