From: qmuntal Date: Wed, 8 Feb 2023 13:08:20 +0000 (+0100) Subject: runtime: use explicit NOFRAME on freebsd/amd64 X-Git-Tag: go1.21rc1~1489 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ddb423a7da378902d1b71eb2c0027cc98a94b075;p=gostls13.git 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 TryBot-Result: Gopher Robot Reviewed-by: Cherry Mui Run-TryBot: Quim Muntal --- diff --git a/src/cmd/internal/obj/x86/obj6.go b/src/cmd/internal/obj/x86/obj6.go index d220751591..3c9e0ed3f5 100644 --- a/src/cmd/internal/obj/x86/obj6.go +++ b/src/cmd/internal/obj/x86/obj6.go @@ -613,7 +613,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { var usefpheuristic bool switch ctxt.Headtype { - case objabi.Hwindows, objabi.Hdarwin, objabi.Hlinux, objabi.Hdragonfly: + case objabi.Hwindows, objabi.Hdarwin, objabi.Hlinux, objabi.Hdragonfly, + objabi.Hfreebsd: default: usefpheuristic = true } diff --git a/src/runtime/sys_freebsd_amd64.s b/src/runtime/sys_freebsd_amd64.s index 374e0ab769..eedab4e2a7 100644 --- a/src/runtime/sys_freebsd_amd64.s +++ b/src/runtime/sys_freebsd_amd64.s @@ -251,16 +251,14 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 MOVL sig+8(FP), DI MOVQ info+16(FP), SI MOVQ ctx+24(FP), DX - PUSHQ BP - MOVQ SP, BP - ANDQ $~15, SP // alignment for x86_64 ABI + MOVQ SP, BX // callee-saved + ANDQ $~15, SP // alignment for x86_64 ABI CALL AX - MOVQ BP, SP - POPQ BP + MOVQ BX, SP RET // Called using C ABI. -TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0 +TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME|NOFRAME,$0 // Transition from C ABI to Go ABI. PUSH_REGS_HOST_TO_ABI0() @@ -285,7 +283,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$0 RET // Called using C ABI. -TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0 +TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT|NOFRAME,$0 // Transition from C ABI to Go ABI. PUSH_REGS_HOST_TO_ABI0()