aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal
diff options
context:
space:
mode:
authorqmuntal <quimmuntal@gmail.com>2023-02-08 09:40:44 +0100
committerQuim Muntal <quimmuntal@gmail.com>2023-02-22 21:35:26 +0000
commit521d2614df0cf4fa3a92bd01e1c98d77bfeac9ed (patch)
tree946da115e94c13f893c7f417e00603197bcc26d8 /src/cmd/internal
parent133e0bca0be23980604ee98589ddcacdb1262afd (diff)
downloadgo-521d2614df0cf4fa3a92bd01e1c98d77bfeac9ed.tar.xz
runtime: use explicit NOFRAME on linux/amd64
This CL marks some linux assembly functions as NOFRAME to avoid relying on the implicit amd64 NOFRAME heuristic, where NOSPLIT functions without stack were also marked as NOFRAME. Updates #58378 Change-Id: I7792cff4f6e539bfa56c02868f2965088ca1975a Reviewed-on: https://go-review.googlesource.com/c/go/+/466316 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Quim Muntal <quimmuntal@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal')
-rw-r--r--src/cmd/internal/obj/x86/obj6.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cmd/internal/obj/x86/obj6.go b/src/cmd/internal/obj/x86/obj6.go
index 8b62120d19..c6fe3279c4 100644
--- a/src/cmd/internal/obj/x86/obj6.go
+++ b/src/cmd/internal/obj/x86/obj6.go
@@ -611,17 +611,23 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
}
}
+ var usefpheuristic bool
+ switch ctxt.Headtype {
+ case objabi.Hwindows, objabi.Hdarwin, objabi.Hlinux:
+ default:
+ usefpheuristic = true
+ }
+
var bpsize int
if ctxt.Arch.Family == sys.AMD64 &&
!p.From.Sym.NoFrame() && // (1) below
- !(autoffset == 0 && p.From.Sym.NoSplit() && ctxt.Headtype != objabi.Hwindows && ctxt.Headtype != objabi.Hdarwin) && // (2) below
+ !(autoffset == 0 && p.From.Sym.NoSplit() && usefpheuristic) && // (2) below
!(autoffset == 0 && !hasCall) { // (3) below
// Make room to save a base pointer.
// There are 2 cases we must avoid:
// 1) If noframe is set (which we do for functions which tail call).
// 2) Scary runtime internals which would be all messed up by frame pointers.
// We detect these using a heuristic: frameless nosplit functions.
- // Windows and Darwin do not use this heuristic anymore.
// TODO: Maybe someday we label them all with NOFRAME and get rid of this heuristic.
// For performance, we also want to avoid:
// 3) Frameless leaf functions