Skip to content

Commit ddb423a

Browse files
committed
runtime: use explicit NOFRAME on freebsd/amd64
This CL marks some freebsd 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: Ibd00748946f1137e165293df7da73278cb673bbd Reviewed-on: https://go-review.googlesource.com/c/go/+/466395 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 21d82e6 commit ddb423a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
613613

614614
var usefpheuristic bool
615615
switch ctxt.Headtype {
616-
case objabi.Hwindows, objabi.Hdarwin, objabi.Hlinux, objabi.Hdragonfly:
616+
case objabi.Hwindows, objabi.Hdarwin, objabi.Hlinux, objabi.Hdragonfly,
617+
objabi.Hfreebsd:
617618
default:
618619
usefpheuristic = true
619620
}

src/runtime/sys_freebsd_amd64.s

+5-7
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,14 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
251251
MOVL sig+8(FP), DI
252252
MOVQ info+16(FP), SI
253253
MOVQ ctx+24(FP), DX
254-
PUSHQ BP
255-
MOVQ SP, BP
256-
ANDQ $~15, SP // alignment for x86_64 ABI
254+
MOVQ SP, BX // callee-saved
255+
ANDQ $~15, SP // alignment for x86_64 ABI
257256
CALL AX
258-
MOVQ BP, SP
259-
POPQ BP
257+
MOVQ BX, SP
260258
RET
261259

262260
// Called using C ABI.
263-
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0
261+
TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME|NOFRAME,$0
264262
// Transition from C ABI to Go ABI.
265263
PUSH_REGS_HOST_TO_ABI0()
266264

@@ -285,7 +283,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0
285283
RET
286284

287285
// Called using C ABI.
288-
TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0
286+
TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT|NOFRAME,$0
289287
// Transition from C ABI to Go ABI.
290288
PUSH_REGS_HOST_TO_ABI0()
291289

0 commit comments

Comments
 (0)