Commit fe67ce2e authored by Russ Cox's avatar Russ Cox

runtime: fix vet complaints for linux/amd64

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

This CL makes "GOOS=linux GOARCH=amd64 go vet -unsafeptr=false runtime" happy,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I4ca1acb02f4666b102d25fcc55fac96b8f80379a
Reviewed-on: https://go-review.googlesource.com/c/go/+/176100
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: default avatarAustin Clements <austin@google.com>
parent 6ed2ec4a
// amd64-specific vet whitelist. See readme.txt for details.
// False positives.
// reflect trampolines intentionally omit arg size. Same for morestack.
runtime/asm_amd64.s: [amd64] morestack: use of 8(SP) points beyond argument frame
runtime/asm_amd64.s: [amd64] morestack: use of 16(SP) points beyond argument frame
runtime/asm_amd64.s: [amd64] morestack: use of 8(SP) points beyond argument frame
// Intentionally missing declarations. These are special assembly routines.
// Some are jumped into from other routines, with values in specific registers.
// duff* have direct calls from the compiler.
// Others use the platform ABI.
// There is no sensible corresponding Go prototype.
runtime/asm_amd64.s: [amd64] aeshashbody: function aeshashbody missing Go declaration
// android/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_linux_amd64.s: [amd64] settls: function settls missing Go declaration
// darwin/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_darwin_amd64.s: [amd64] settls: function settls missing Go declaration
// dragonfly/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_dragonfly_amd64.s: [amd64] settls: function settls missing Go declaration
syscall/asm9_unix2_amd64.s: [amd64] Syscall9: 8(SP) should be num+0(FP)
syscall/asm9_unix2_amd64.s: [amd64] Syscall9: 16(SP) should be a1+8(FP)
......
// freebsd/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_freebsd_amd64.s: [amd64] settls: function settls missing Go declaration
syscall/asm9_unix2_amd64.s: [amd64] Syscall9: 8(SP) should be num+0(FP)
syscall/asm9_unix2_amd64.s: [amd64] Syscall9: 16(SP) should be a1+8(FP)
syscall/asm9_unix2_amd64.s: [amd64] Syscall9: 24(SP) should be a2+16(FP)
// illumos/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_solaris_amd64.s: [amd64] settls: function settls missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] pipe1: function pipe1 missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] asmsysvicall6: function asmsysvicall6 missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] usleep2: function usleep2 missing Go declaration
// linux/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_linux_amd64.s: [amd64] settls: function settls missing Go declaration
......@@ -10,7 +10,6 @@ runtime/sys_nacl_amd64p32.s: [amd64p32] sigtramp: unknown variable ctxt
runtime/sys_nacl_amd64p32.s: [amd64p32] sigtramp: unknown variable ctxt
runtime/sys_nacl_amd64p32.s: [amd64p32] nacl_sysinfo: function nacl_sysinfo missing Go declaration
runtime/sys_nacl_amd64p32.s: [amd64p32] nacl_clock_gettime: function nacl_clock_gettime missing Go declaration
runtime/sys_nacl_amd64p32.s: [amd64p32] settls: function settls missing Go declaration
// Clearer using FP than SP, but that requires named offsets.
runtime/asm_amd64p32.s: [amd64p32] rt0_go: unknown variable argc
......
// netbsd/386-specific vet whitelist. See readme.txt for details.
runtime/sys_netbsd_ARCHSUFF.s: [GOARCH] settls: function settls missing Go declaration
runtime/sys_netbsd_ARCHSUFF.s: [GOARCH] sigreturn_tramp: function sigreturn_tramp missing Go declaration
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
......
// netbsd/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_netbsd_ARCHSUFF.s: [GOARCH] sigreturn_tramp: function sigreturn_tramp missing Go declaration
runtime/sys_netbsd_amd64.s: [amd64] settls: function settls missing Go declaration
......@@ -3,7 +3,6 @@
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
runtime/sys_openbsd_386.s: [386] settls: function settls missing Go declaration
syscall/asm_unix_386.s: [386] Syscall: 8(SP) should be a1+4(FP)
syscall/asm_unix_386.s: [386] Syscall: 4(SP) should be trap+0(FP)
syscall/asm_unix_386.s: [386] Syscall6: 8(SP) should be a1+4(FP)
......
// openbsd/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_openbsd_amd64.s: [amd64] settls: function settls missing Go declaration
// plan9/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_plan9_amd64.s: [amd64] settls: function settls missing Go declaration
// solaris/amd64-specific vet whitelist. See readme.txt for details.
runtime/sys_solaris_amd64.s: [amd64] settls: function settls missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] pipe1: function pipe1 missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] asmsysvicall6: function asmsysvicall6 missing Go declaration
runtime/sys_solaris_amd64.s: [amd64] usleep2: function usleep2 missing Go declaration
......@@ -3,4 +3,3 @@
runtime/sys_windows_amd64.s: [amd64] ctrlhandler: RET without writing to 4-byte ret+8(FP)
runtime/sys_windows_amd64.s: [amd64] callbackasm1: function callbackasm1 missing Go declaration
runtime/sys_windows_amd64.s: [amd64] tstart_stdcall: RET without writing to 4-byte ret+8(FP)
runtime/sys_windows_amd64.s: [amd64] settls: function settls missing Go declaration
......@@ -424,6 +424,7 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
// Called from f.
// Set m->morebuf to f's caller.
NOP SP // tell vet SP changed - stop checking offsets
MOVQ 8(SP), AX // f's caller's PC
MOVQ AX, (m_morebuf+gobuf_pc)(BX)
LEAQ 16(SP), AX // f's caller's SP
......@@ -890,7 +891,7 @@ TEXT runtime·aeshash(SB),NOSPLIT,$0-32
MOVQ p+0(FP), AX // ptr to data
MOVQ s+16(FP), CX // size
LEAQ ret+24(FP), DX
JMP runtime·aeshashbody(SB)
JMP aeshashbody<>(SB)
// func aeshashstr(p unsafe.Pointer, h uintptr) uintptr
TEXT runtime·aeshashstr(SB),NOSPLIT,$0-24
......@@ -898,12 +899,12 @@ TEXT runtime·aeshashstr(SB),NOSPLIT,$0-24
MOVQ 8(AX), CX // length of string
MOVQ (AX), AX // string data
LEAQ ret+16(FP), DX
JMP runtime·aeshashbody(SB)
JMP aeshashbody<>(SB)
// AX: data
// CX: length
// DX: address to put return value
TEXT runtime·aeshashbody(SB),NOSPLIT,$0-0
TEXT aeshashbody<>(SB),NOSPLIT,$0-0
// Fill an SSE register with our seeds.
MOVQ h+8(FP), X0 // 64 bits of per-table hash seed
PINSRW $4, CX, X0 // 16 bits of length
......
......@@ -9,6 +9,9 @@ import "unsafe"
func float64touint32(a float64) uint32
func uint32tofloat64(a uint32) float64
// stackcheck checks that SP is in range [g->stack.lo, g->stack.hi).
func stackcheck()
// Called from assembly only; declared for go vet.
func setldt(slot uintptr, base unsafe.Pointer, size uintptr)
func emptyfunc()
......@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build amd64 amd64p32 386
// +build amd64 amd64p32
package runtime
// stackcheck checks that SP is in range [g->stack.lo, g->stack.hi).
func stackcheck()
// Called from assembly only; declared for go vet.
func settls() // argument in DI
......@@ -324,7 +324,7 @@ TEXT runtime·lwp_tramp(SB),NOSPLIT,$0
LEAL m_tls(BX), BP
PUSHAL // save registers
PUSHL BP
CALL runtime·settls(SB)
CALL lwp_setprivate<>(SB)
POPL AX
POPAL
......@@ -363,10 +363,10 @@ TEXT runtime·setldt(SB),NOSPLIT,$8
// Under NetBSD we set the GS base instead of messing with the LDT.
MOVL base+4(FP), AX
MOVL AX, 0(SP)
CALL runtime·settls(SB)
CALL lwp_setprivate<>(SB)
RET
TEXT runtime·settls(SB),NOSPLIT,$16
TEXT lwp_setprivate<>(SB),NOSPLIT,$16
// adjust for ELF: wants to use -4(GS) for g
MOVL base+0(FP), CX
ADDL $4, CX
......
......@@ -292,7 +292,7 @@ TEXT runtime·tfork(SB),NOSPLIT,$12
LEAL m_tls(BX), BP
PUSHAL // save registers
PUSHL BP
CALL runtime·settls(SB)
CALL set_tcb<>(SB)
POPL AX
POPAL
......@@ -331,10 +331,10 @@ TEXT runtime·setldt(SB),NOSPLIT,$4
// Under OpenBSD we set the GS base instead of messing with the LDT.
MOVL base+4(FP), AX
MOVL AX, 0(SP)
CALL runtime·settls(SB)
CALL set_tcb<>(SB)
RET
TEXT runtime·settls(SB),NOSPLIT,$8
TEXT set_tcb<>(SB),NOSPLIT,$8
// adjust for ELF: wants to use -4(GS) for g
MOVL tlsbase+0(FP), CX
ADDL $4, CX
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment