1
0
mirror of https://github.com/golang/go synced 2024-11-23 19:30:05 -07:00

runtime: fix vet complaints for all freebsd, netbsd, openbsd

Working toward making the tree vet-safe instead of having
so many exceptions in cmd/vet/all/whitelist.

This CL makes "go vet -unsafeptr=false runtime" happy for these GOOSes,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I63c4805bdd44b301072da66c77086940e2a2765e
Reviewed-on: https://go-review.googlesource.com/c/go/+/176105
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Russ Cox 2019-05-08 15:30:33 -04:00
parent b4a472b1c3
commit 924c161de4
10 changed files with 29 additions and 44 deletions

View File

@ -1,8 +0,0 @@
// freebsd/386-specific vet whitelist. See readme.txt for details.
runtime/sys_freebsd_386.s: [386] thr_start: unknown variable mm
runtime/sys_freebsd_386.s: [386] sigtramp: unknown variable signo
runtime/sys_freebsd_386.s: [386] sigtramp: unknown variable info
runtime/sys_freebsd_386.s: [386] sigtramp: unknown variable context
runtime/sys_freebsd_386.s: [386] sigtramp: unknown variable context
runtime/sys_freebsd_386.s: [386] i386_set_ldt: function i386_set_ldt missing Go declaration

View File

@ -1,9 +0,0 @@
// netbsd/386-specific vet whitelist. See readme.txt for details.
runtime/sys_netbsd_386.s: [386] sigreturn_tramp: use of 140(SP) points beyond argument frame
runtime/sys_netbsd_386.s: [386] sigreturn_tramp: use of 4(SP) points beyond argument frame
runtime/sys_netbsd_386.s: [386] sigreturn_tramp: use of 4(SP) points beyond argument frame
runtime/sys_netbsd_386.s: [386] sigtramp: unknown variable signo
runtime/sys_netbsd_386.s: [386] sigtramp: unknown variable info
runtime/sys_netbsd_386.s: [386] sigtramp: unknown variable context

View File

@ -1 +0,0 @@
runtime/sys_netbsd_ARCHSUFF.s: [GOARCH] sigreturn_tramp: function sigreturn_tramp missing Go declaration

View File

@ -1,5 +0,0 @@
// openbsd/386-specific vet whitelist. See readme.txt for details.
runtime/sys_openbsd_386.s: [386] sigtramp: unknown variable signo
runtime/sys_openbsd_386.s: [386] sigtramp: unknown variable info
runtime/sys_openbsd_386.s: [386] sigtramp: unknown variable context

View File

@ -22,8 +22,10 @@ TEXT runtime·thr_new(SB),NOSPLIT,$-4
MOVL AX, ret+8(FP)
RET
// Called by OS using C ABI.
TEXT runtime·thr_start(SB),NOSPLIT,$0
MOVL mm+0(FP), AX
NOP SP // tell vet SP changed - stop checking offsets
MOVL 4(SP), AX // m
MOVL m_g0(AX), BX
LEAL m_tls(AX), BP
MOVL m_id(AX), DI
@ -234,17 +236,19 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16
MOVL AX, SP
RET
// Called by OS using C ABI.
TEXT runtime·sigtramp(SB),NOSPLIT,$12
MOVL signo+0(FP), BX
NOP SP // tell vet SP changed - stop checking offsets
MOVL 16(SP), BX // signo
MOVL BX, 0(SP)
MOVL info+4(FP), BX
MOVL 20(SP), BX // info
MOVL BX, 4(SP)
MOVL context+8(FP), BX
MOVL 24(SP), BX // context
MOVL BX, 8(SP)
CALL runtime·sigtrampgo(SB)
// call sigreturn
MOVL context+8(FP), AX
MOVL 24(SP), AX // context
MOVL $0, 0(SP) // syscall gap
MOVL AX, 4(SP)
MOVL $417, AX // sigreturn(ucontext)
@ -319,7 +323,7 @@ TEXT runtime·setldt(SB),NOSPLIT,$32
MOVL $0xffffffff, 0(SP) // auto-allocate entry and return in AX
MOVL AX, 4(SP)
MOVL $1, 8(SP)
CALL runtime·i386_set_ldt(SB)
CALL i386_set_ldt<>(SB)
// compute segment selector - (entry*8+7)
SHLL $3, AX
@ -327,7 +331,7 @@ TEXT runtime·setldt(SB),NOSPLIT,$32
MOVW AX, GS
RET
TEXT runtime·i386_set_ldt(SB),NOSPLIT,$16
TEXT i386_set_ldt<>(SB),NOSPLIT,$16
LEAL args+0(FP), AX // 0(FP) == 4(SP) before SP got moved
MOVL $0, 0(SP) // syscall gap
MOVL $1, 4(SP)

View File

@ -236,7 +236,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$-4
MOVL $0xf1, 0xf1 // crash
RET
TEXT runtime·sigreturn_tramp(SB),NOSPLIT,$0
TEXT sigreturn_tramp<>(SB),NOSPLIT,$0
LEAL 140(SP), AX // Load address of ucontext
MOVL AX, 4(SP)
MOVL $SYS_setcontext, AX
@ -252,7 +252,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$24
MOVSL // arg 1 - sig
MOVSL // arg 2 - act
MOVSL // arg 3 - oact
LEAL runtime·sigreturn_tramp(SB), AX
LEAL sigreturn_tramp<>(SB), AX
STOSL // arg 4 - tramp
MOVL $2, AX
STOSL // arg 5 - vers
@ -279,7 +279,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16
MOVL AX, SP
RET
// Called by OS using C ABI.
TEXT runtime·sigtramp(SB),NOSPLIT,$28
NOP SP // tell vet SP changed - stop checking offsets
// Save callee-saved C registers, since the caller may be a C signal handler.
MOVL BX, bx-4(SP)
MOVL BP, bp-8(SP)
@ -288,11 +290,11 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$28
// We don't save mxcsr or the x87 control word because sigtrampgo doesn't
// modify them.
MOVL signo+0(FP), BX
MOVL 32(SP), BX // signo
MOVL BX, 0(SP)
MOVL info+4(FP), BX
MOVL 36(SP), BX // info
MOVL BX, 4(SP)
MOVL context+8(FP), BX
MOVL 40(SP), BX // context
MOVL BX, 8(SP)
CALL runtime·sigtrampgo(SB)

View File

@ -258,7 +258,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$0
MOVL $0xf1, 0xf1 // crash
RET
TEXT runtime·sigreturn_tramp(SB),NOSPLIT,$-8
TEXT sigreturn_tramp<>(SB),NOSPLIT,$-8
MOVQ R15, DI // Load address of ucontext
MOVQ $SYS_setcontext, AX
SYSCALL
@ -271,7 +271,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$-8
MOVQ new+8(FP), SI // arg 2 - nsa
MOVQ old+16(FP), DX // arg 3 - osa
// arg 4 - tramp
LEAQ runtime·sigreturn_tramp(SB), R10
LEAQ sigreturn_tramp<>(SB), R10
MOVQ $2, R8 // arg 5 - vers
MOVL $SYS___sigaction_sigtramp, AX
SYSCALL

View File

@ -240,7 +240,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$0
MOVW.CS R8, (R8)
RET
TEXT runtime·sigreturn_tramp(SB),NOSPLIT|NOFRAME,$0
TEXT sigreturn_tramp<>(SB),NOSPLIT|NOFRAME,$0
// on entry, SP points to siginfo, we add sizeof(ucontext)
// to SP to get a pointer to ucontext.
ADD $0x80, R13, R0 // 0x80 == sizeof(UcontextT)
@ -254,7 +254,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$4
MOVW sig+0(FP), R0 // arg 1 - signum
MOVW new+4(FP), R1 // arg 2 - nsa
MOVW old+8(FP), R2 // arg 3 - osa
MOVW $runtime·sigreturn_tramp(SB), R3 // arg 4 - tramp
MOVW $sigreturn_tramp<>(SB), R3 // arg 4 - tramp
MOVW $2, R4 // arg 5 - vers
MOVW R4, 4(R13)
ADD $4, R13 // pass arg 5 on stack

View File

@ -249,7 +249,7 @@ fail:
MOVD $0, R0
MOVD R0, (R0) // crash
TEXT runtime·sigreturn_tramp(SB),NOSPLIT,$-8
TEXT sigreturn_tramp<>(SB),NOSPLIT,$-8
MOVD g, R0
SVC $SYS_setcontext
MOVD $0x4242, R0 // Something failed, return magic number
@ -260,7 +260,7 @@ TEXT runtime·sigaction(SB),NOSPLIT,$-8
MOVD new+8(FP), R1 // arg 2 - nsa
MOVD old+16(FP), R2 // arg 3 - osa
// arg 4 - tramp
MOVD $runtime·sigreturn_tramp(SB), R3
MOVD $sigreturn_tramp<>(SB), R3
MOVW $2, R4 // arg 5 - vers
SVC $SYS___sigaction_sigtramp
BCS fail

View File

@ -218,7 +218,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$12-16
MOVL AX, SP
RET
// Called by OS using C ABI.
TEXT runtime·sigtramp(SB),NOSPLIT,$28
NOP SP // tell vet SP changed - stop checking offsets
// Save callee-saved C registers, since the caller may be a C signal handler.
MOVL BX, bx-4(SP)
MOVL BP, bp-8(SP)
@ -227,11 +229,11 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$28
// We don't save mxcsr or the x87 control word because sigtrampgo doesn't
// modify them.
MOVL signo+0(FP), BX
MOVL 32(SP), BX // signo
MOVL BX, 0(SP)
MOVL info+4(FP), BX
MOVL 36(SP), BX // info
MOVL BX, 4(SP)
MOVL context+8(FP), BX
MOVL 40(SP), BX // context
MOVL BX, 8(SP)
CALL runtime·sigtrampgo(SB)