d1ef967306
If trampolines may be required, the current text addressing second pass resets all assigned addresses, before assigning addresses and laying down trampolines in a linear fashion. However, this approach means that intra-package calls are to a symbol that has not yet been assigned an address, when the symbol is ahead of the current function. In the case of RISC-V the JAL instruction is limited to +/-1MiB. As such, if a call is to a symbol with no address currently assigned, we have to assume that a trampoline will be required. During the relocation phase we can fix up and avoid trampolines in some cases, however this results in unused trampolines that are still present in the binary (since removing them would change text addresses). In order to significantly reduce the number of unused trampolines, assign temporary addresses to functions within the same package, based on the maximum number of trampolines that may be required by a function. This allows for better decisions to be made regarding the requirement for intra-package trampolines, as we reset the addressing for a function, assign its final address and lay down any resulting trampolines. This results in ~2,300 unused trampolines being removed from the Go binary and ~5,600 unused trampolines being removed from the compile binary, on linux/riscv64. This reapplies CL 349650, however does not pass big to assignAddress when assigning temporary addresses, as this can result in side effects such as section splitting. Change-Id: Id7febdb65d962d6b1297a91294a8dc27c94d8696 Reviewed-on: https://go-review.googlesource.com/c/go/+/534760 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
go.env | ||
LICENSE | ||
PATENTS | ||
README.md | ||
SECURITY.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.