]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix vet complaints for linux/amd64
authorRuss Cox <rsc@golang.org>
Wed, 8 May 2019 17:16:05 +0000 (13:16 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 9 May 2019 21:13:19 +0000 (21:13 +0000)
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: Austin Clements <austin@google.com>
20 files changed:
src/cmd/vet/all/whitelist/amd64.txt [deleted file]
src/cmd/vet/all/whitelist/android_amd64.txt [deleted file]
src/cmd/vet/all/whitelist/darwin_amd64.txt [deleted file]
src/cmd/vet/all/whitelist/dragonfly_amd64.txt
src/cmd/vet/all/whitelist/freebsd_amd64.txt
src/cmd/vet/all/whitelist/illumos_amd64.txt
src/cmd/vet/all/whitelist/linux_amd64.txt [deleted file]
src/cmd/vet/all/whitelist/nacl_amd64p32.txt
src/cmd/vet/all/whitelist/netbsd_386.txt
src/cmd/vet/all/whitelist/netbsd_amd64.txt [deleted file]
src/cmd/vet/all/whitelist/openbsd_386.txt
src/cmd/vet/all/whitelist/openbsd_amd64.txt [deleted file]
src/cmd/vet/all/whitelist/plan9_amd64.txt [deleted file]
src/cmd/vet/all/whitelist/solaris_amd64.txt
src/cmd/vet/all/whitelist/windows_amd64.txt
src/runtime/asm_amd64.s
src/runtime/stubs_386.go
src/runtime/stubs_amd64x.go [moved from src/runtime/stubs_x86.go with 70% similarity]
src/runtime/sys_netbsd_386.s
src/runtime/sys_openbsd_386.s

diff --git a/src/cmd/vet/all/whitelist/amd64.txt b/src/cmd/vet/all/whitelist/amd64.txt
deleted file mode 100644 (file)
index 5ce30cc..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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
diff --git a/src/cmd/vet/all/whitelist/android_amd64.txt b/src/cmd/vet/all/whitelist/android_amd64.txt
deleted file mode 100644 (file)
index 90dabb0..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// android/amd64-specific vet whitelist. See readme.txt for details.
-
-runtime/sys_linux_amd64.s: [amd64] settls: function settls missing Go declaration
diff --git a/src/cmd/vet/all/whitelist/darwin_amd64.txt b/src/cmd/vet/all/whitelist/darwin_amd64.txt
deleted file mode 100644 (file)
index fcdacb2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// darwin/amd64-specific vet whitelist. See readme.txt for details.
-
-runtime/sys_darwin_amd64.s: [amd64] settls: function settls missing Go declaration
index 6c44159793999d71e29a2bd8a381158177ade35f..0db5503ef0bde7ae45f29184cd20c3608003ac07 100644 (file)
@@ -1,6 +1,5 @@
 // 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)
index a910f48ca5d7503d3fffcf9354aeccce8e9f459a..356be022ccbe85ab170d2a2c972b45007f6667af 100644 (file)
@@ -1,6 +1,5 @@
 // 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)
index 4525c03cd79fd7c41971803dd4ff9277ce413b5a..30f3912e3eabb0b7e3072dd3ccc63bfcc3faa538 100644 (file)
@@ -1,6 +1,5 @@
 // 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
diff --git a/src/cmd/vet/all/whitelist/linux_amd64.txt b/src/cmd/vet/all/whitelist/linux_amd64.txt
deleted file mode 100644 (file)
index 2f4a933..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// linux/amd64-specific vet whitelist. See readme.txt for details.
-
-runtime/sys_linux_amd64.s: [amd64] settls: function settls missing Go declaration
index b3d6aa40a1b76a08f07d02816ce8a6c77253087d..fb95a360a6bd0436439a965e098b86ee4751e2ca 100644 (file)
@@ -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
index a85c6e0f784eca37ea30e8e14082afefe0387b79..608021cae474786d2a4db14aa1b4e4da2e0a4506 100644 (file)
@@ -1,8 +1,5 @@
 // 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
diff --git a/src/cmd/vet/all/whitelist/netbsd_amd64.txt b/src/cmd/vet/all/whitelist/netbsd_amd64.txt
deleted file mode 100644 (file)
index 23b6a8c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// 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
index 66172ff00899e6e3054f1cf9a4e7cbfa4433a86a..bfbf4d9c56cd53ea96184db52a4954e011c0d22d 100644 (file)
@@ -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)
diff --git a/src/cmd/vet/all/whitelist/openbsd_amd64.txt b/src/cmd/vet/all/whitelist/openbsd_amd64.txt
deleted file mode 100644 (file)
index 433f62c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// openbsd/amd64-specific vet whitelist. See readme.txt for details.
-
-runtime/sys_openbsd_amd64.s: [amd64] settls: function settls missing Go declaration
diff --git a/src/cmd/vet/all/whitelist/plan9_amd64.txt b/src/cmd/vet/all/whitelist/plan9_amd64.txt
deleted file mode 100644 (file)
index 1390475..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-// plan9/amd64-specific vet whitelist. See readme.txt for details.
-
-runtime/sys_plan9_amd64.s: [amd64] settls: function settls missing Go declaration
index 26a9da42710bd10776712e03dd34b84d51eace18..19f66f75889c5056b7bd9c7293c52a113e4a6989 100644 (file)
@@ -1,6 +1,5 @@
 // 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
index 4e6da405e3d102de56dc3199b6a39d50168525cb..348afd152e5e9129950d8eda76d6f1b583617535 100644 (file)
@@ -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
index 2807f4c23846eb01882b642ad61663bba1e6f61e..fd3a9c3127e495ad3d602a0997944561f76f0821 100644 (file)
@@ -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
index ecdf0a9df040b6ca0941ef3ac90312fe1727e6c1..5108294d83375750819c817b8a06e82658e7407c 100644 (file)
@@ -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()
similarity index 70%
rename from src/runtime/stubs_x86.go
rename to src/runtime/stubs_amd64x.go
index 830c48bd013447b017ca3b82abb180d5e79d9979..e7a1be81359a579aca39e201deeb54e191599681 100644 (file)
@@ -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
index ee4e3cf5a29295f1b7734839789d54824ad8d986..960e4d55e491560d06d98b75ff5a1a0cd6b3eecf 100644 (file)
@@ -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
index 741907312e3f4d09d82e39cc5515b924c245856c..a45e1ea2825e10918b61a99f3f1af4d542a4bc6d 100644 (file)
@@ -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