Currently, for the shared build mode, we don't generate the module inittasks. Instead, we rely on the main executable to do the initialization, for both the executable and the shared library. But, with the model as of CL 478916, the main executable only has relocations to packages that are directly imported. It won't see the dependency edges between packages within a shared library. Therefore indirect dependencies are not included, and thus not initialized. E.g. main imports a, which imports b, but main doesn't directly import b. a and b are in a shared object. When linking main, it sees main depends on a, so it generates main's inittasks to run a's init before main's, but it doesn't know b, so b's init doesn't run. This CL makes it initialize all packages in a shared library when the library is loaded, as any of them could potentially be imported, directly or indirectly. Also, in the runtime, when running the init functions, make sure to go through the DSOs in dependency order. Otherwise packages can be initialized in the wrong order. Fixes #61973. Change-Id: I2a090336fe9fa0d6c7e43912f3ab233c9c47e247 Reviewed-on: https://go-review.googlesource.com/c/go/+/520375 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> |
||
|---|---|---|
| .github | ||
| api | ||
| doc | ||
| lib/time | ||
| misc | ||
| src | ||
| test | ||
| .gitattributes | ||
| .gitignore | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| PATENTS | ||
| README.md | ||
| SECURITY.md | ||
| codereview.cfg | ||
| go.env | ||
README.md
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.