9d032026d6
The x86 assembler supports an "ADJSP" pseudo-op that compiles to an ADD/SUB from SP. Unfortunately, while this seems perfect for an instruction that would allow obj to continue to track the SP/FP delta, obj currently doesn't do that. As a result, FP-relative references won't work and, perhaps worse, the pcsp table will have the wrong frame size. We don't currently use this instruction in any assembly or generate it in the compiler, but this is a perfect instruction for solving a problem in #24543. This CL makes ADJSP useful by incorporating it into the SP delta logic. One subtlety is that we do generate ADJSP in obj itself to open a function's stack frame. Currently, when preprocess enters the loop to compute the SP delta, it may or may not start at this ADJSP instruction depending on various factors. We clean this up by instead always starting the SP delta at 0 and always starting this loop at the entry to the function. Why not just recognize ADD/SUB of SP? The danger is that could change the meaning of existing code. For example, walltime1 in sys_linux_amd64.s saves SP, SUBs from it, and aligns it. Later, it restores the saved copy and then does a few FP-relative references. Currently obj doesn't know any of this is happening, but that's fine once it gets to the FP-relative references. If we taught obj to recognize the SUB, it would start to miscompile this code. An alternative would be to recognize unknown instructions that write to SP and refuse subsequent FP-relative references, but that's kind of annoying. This passes toolstash -cmp for std on both amd64 and 386. Change-Id: Ic6c6a7cbf980bca904576676c07b44c0aaa9c82d Reviewed-on: https://go-review.googlesource.com/c/go/+/200877 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
favicon.ico | ||
LICENSE | ||
PATENTS | ||
README.md | ||
robots.txt | ||
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 3.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://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.