cmd/internal/obj: add LookupInit
There are some LSyms that are lazily initialized, and which cannot be made eagerly initialized, such as elements of a constant pool. To avoid needing a mutex to protect the internals of those LSyms, this CL introduces LookupInit, which allows an LSym to be initialized only once. By itself this is not fully concurrency-safe, but Ctxt.Hash will need mutex protection anyway, and that will be enough to support one-time LSym initialization. Passes toolstash-check -all. Updates #15756 Change-Id: Id7248dfdc4dfbdfe425fa31d0c0045018eeea1fa Reviewed-on: https://go-review.googlesource.com/39990 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Showing
Please register or sign in to comment