Skip to content

Commit f76fc28

Browse files
committed
runtime: use explicit NOFRAME on netbsd/amd64
This CL marks some netbsd assembly functions as NOFRAME to avoid relying on the implicit amd64 NOFRAME heuristic, where NOSPLIT functions without stack were also marked as NOFRAME. While here, and thanks to CL 466355, `asm_netbsd_amd64.s` can be deleted in favor of `asm9_unix2_amd64.s`, which makes better use of the frame pointer. Updates #58378 Change-Id: Iff554b664ec25f2bb6ec198c0f684590b359c383 Reviewed-on: https://go-review.googlesource.com/c/go/+/466396 Reviewed-by: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Run-TryBot: Quim Muntal <[email protected]>
1 parent b87c8c3 commit f76fc28

File tree

4 files changed

+7
-52
lines changed

4 files changed

+7
-52
lines changed

src/cmd/internal/obj/x86/obj6.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
614614
var usefpheuristic bool
615615
switch ctxt.Headtype {
616616
case objabi.Hwindows, objabi.Hdarwin, objabi.Hlinux, objabi.Hdragonfly,
617-
objabi.Hfreebsd:
617+
objabi.Hfreebsd, objabi.Hnetbsd:
618618
default:
619619
usefpheuristic = true
620620
}

src/runtime/sys_netbsd_amd64.s

+4-6
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,14 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
296296
MOVL sig+8(FP), DI
297297
MOVQ info+16(FP), SI
298298
MOVQ ctx+24(FP), DX
299-
PUSHQ BP
300-
MOVQ SP, BP
301-
ANDQ $~15, SP // alignment for x86_64 ABI
299+
MOVQ SP, BX // callee-saved
300+
ANDQ $~15, SP // alignment for x86_64 ABI
302301
CALL AX
303-
MOVQ BP, SP
304-
POPQ BP
302+
MOVQ BX, SP
305303
RET
306304

307305
// Called using C ABI.
308-
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0
306+
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME|NOFRAME,$0
309307
// Transition from C ABI to Go ABI.
310308
PUSH_REGS_HOST_TO_ABI0()
311309

src/syscall/asm9_unix2_amd64.s

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build dragonfly || freebsd
5+
//go:build dragonfly || freebsd || netbsd
66

77
#include "textflag.h"
88
#include "funcdata.h"
99

1010
//
11-
// Syscall9 support for AMD64, DragonFly and FreeBSD
11+
// Syscall9 support for AMD64, DragonFly, FreeBSD and NetBSD
1212
//
1313

1414
// func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64);

src/syscall/asm_netbsd_amd64.s

-43
This file was deleted.

0 commit comments

Comments
 (0)