]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix vet complaints for all freebsd, netbsd, openbsd
authorRuss Cox <rsc@golang.org>
Wed, 8 May 2019 19:30:33 +0000 (15:30 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 9 May 2019 21:13:26 +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 "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>
src/cmd/vet/all/whitelist/freebsd_386.txt [deleted file]
src/cmd/vet/all/whitelist/netbsd_386.txt [deleted file]
src/cmd/vet/all/whitelist/netbsd_arm64.txt [deleted file]
src/cmd/vet/all/whitelist/openbsd_386.txt [deleted file]
src/runtime/sys_freebsd_386.s
src/runtime/sys_netbsd_386.s
src/runtime/sys_netbsd_amd64.s
src/runtime/sys_netbsd_arm.s
src/runtime/sys_netbsd_arm64.s
src/runtime/sys_openbsd_386.s

diff --git a/src/cmd/vet/all/whitelist/freebsd_386.txt b/src/cmd/vet/all/whitelist/freebsd_386.txt
deleted file mode 100644 (file)
index ed83a3e..0000000
+++ /dev/null
@@ -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
diff --git a/src/cmd/vet/all/whitelist/netbsd_386.txt b/src/cmd/vet/all/whitelist/netbsd_386.txt
deleted file mode 100644 (file)
index bd2151d..0000000
+++ /dev/null
@@ -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
-
diff --git a/src/cmd/vet/all/whitelist/netbsd_arm64.txt b/src/cmd/vet/all/whitelist/netbsd_arm64.txt
deleted file mode 100644 (file)
index 57d2135..0000000
+++ /dev/null
@@ -1 +0,0 @@
-runtime/sys_netbsd_ARCHSUFF.s: [GOARCH] sigreturn_tramp: function sigreturn_tramp missing Go declaration
diff --git a/src/cmd/vet/all/whitelist/openbsd_386.txt b/src/cmd/vet/all/whitelist/openbsd_386.txt
deleted file mode 100644 (file)
index acda942..0000000
+++ /dev/null
@@ -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
index 26a81ebf443f1f11068e6e488b326e2797d01fed..35f357a1d9cbf3dac9db9f9eae603406dbf114dc 100644 (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)
index 960e4d55e491560d06d98b75ff5a1a0cd6b3eecf..c14ecfb2e0852d361ce66cfe1e0ab4ce805b3149 100644 (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)
 
index 588d811287152fbe13af654b1869163b385e31e3..77dc00dc60c81ebe44ba1cbe7912a05dde857968 100644 (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
index e8f096807b0ce725fc5e8a7e23ef4aa115342559..c32259b34d7cae2f485529024545e3c658033081 100644 (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
index 6f188ea995de7aa5ef195f0cd4dce2f156770cbe..09c2f28f90e49fbb692c0341d318eff8fb6b3345 100644 (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
index a45e1ea2825e10918b61a99f3f1af4d542a4bc6d..6457e37c012063be373452db3672f8b323e637c7 100644 (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)