]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix vet complaints for linux/arm64, linux/mips*, linux/ppc64*, linux/s390x
authorRuss Cox <rsc@golang.org>
Wed, 8 May 2019 17:59:48 +0000 (13:59 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 9 May 2019 21:13:22 +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 GOOS/GOARCHes,
except for an unresolved complaint on mips/mipsle that is a bug in vet,
while keeping "GO_BUILDER_NAME=misc-vetall go tool dist test" happy too.

For #31916.

Change-Id: I6ef7e982a2fdbbfbc22cee876ca37ac54d8109e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/176102
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
18 files changed:
src/cmd/vet/all/whitelist/aix_ppc64.txt [deleted file]
src/cmd/vet/all/whitelist/arm64.txt [deleted file]
src/cmd/vet/all/whitelist/linux_ppc64x.txt [deleted file]
src/cmd/vet/all/whitelist/mips.txt [deleted file]
src/cmd/vet/all/whitelist/mipsle.txt [deleted file]
src/runtime/asm_ppc64x.s
src/runtime/asm_s390x.s
src/runtime/memclr_s390x.s
src/runtime/memmove_s390x.s
src/runtime/stubs_arm64.go [new file with mode: 0644]
src/runtime/stubs_mips64x.go [new file with mode: 0644]
src/runtime/stubs_mipsx.go [new file with mode: 0644]
src/runtime/stubs_ppc64x.go [new file with mode: 0644]
src/runtime/stubs_s390x.go [new file with mode: 0644]
src/runtime/sys_aix_ppc64.s
src/runtime/sys_linux_mipsx.s
src/runtime/sys_linux_ppc64x.s
src/runtime/sys_linux_s390x.s

diff --git a/src/cmd/vet/all/whitelist/aix_ppc64.txt b/src/cmd/vet/all/whitelist/aix_ppc64.txt
deleted file mode 100644 (file)
index bfd76e9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// aix/ppc64-specific vet whitelist. See readme.txt for details.
-
-runtime/asm_ppc64x.s: [ppc64] sigreturn: function sigreturn missing Go declaration
-runtime/sys_aix_ppc64.s: [ppc64] _asmsyscall6: function _asmsyscall6 missing Go declaration
-runtime/sys_aix_ppc64.s: [ppc64] _tstart: function _tstart missing Go declaration
diff --git a/src/cmd/vet/all/whitelist/arm64.txt b/src/cmd/vet/all/whitelist/arm64.txt
deleted file mode 100644 (file)
index cd9577b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// arm64-specific vet whitelist. See readme.txt for details.
-
-// Intentionally missing declarations.
-runtime/tls_arm64.s: [arm64] load_g: function load_g missing Go declaration
-runtime/tls_arm64.s: [arm64] save_g: function save_g missing Go declaration
diff --git a/src/cmd/vet/all/whitelist/linux_ppc64x.txt b/src/cmd/vet/all/whitelist/linux_ppc64x.txt
deleted file mode 100644 (file)
index 0091d97..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// linux/ppc64-specific vet whitelist. See readme.txt for details.
-
-runtime/sys_linux_ppc64x.s: [GOARCH] _sigtramp: function _sigtramp missing Go declaration
-runtime/sys_linux_ppc64x.s: [GOARCH] _cgoSigtramp: function _cgoSigtramp missing Go declaration
diff --git a/src/cmd/vet/all/whitelist/mips.txt b/src/cmd/vet/all/whitelist/mips.txt
deleted file mode 100644 (file)
index fa17c62..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// mips-specific (big endian) vet whitelist. See readme.txt for details.
-
-// Work around if-def'd code. Will be fixed by golang.org/issue/17544.
-runtime/sys_linux_mipsx.s: [mips] walltime: invalid offset sec_lo+0(FP); expected sec_lo+4(FP)
-runtime/sys_linux_mipsx.s: [mips] walltime: invalid offset sec_hi+4(FP); expected sec_hi+0(FP)
-runtime/sys_linux_mipsx.s: [mips] nanotime: invalid offset ret_lo+0(FP); expected ret_lo+4(FP)
-runtime/sys_linux_mipsx.s: [mips] nanotime: invalid offset ret_hi+4(FP); expected ret_hi+0(FP)
diff --git a/src/cmd/vet/all/whitelist/mipsle.txt b/src/cmd/vet/all/whitelist/mipsle.txt
deleted file mode 100644 (file)
index 9361dc4..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// mipsle-specific vet whitelist. See readme.txt for details.
-
-// Work around if-def'd code. Will be fixed by golang.org/issue/17544.
-runtime/sys_linux_mipsx.s: [mipsle] walltime: invalid offset sec_lo+4(FP); expected sec_lo+0(FP)
-runtime/sys_linux_mipsx.s: [mipsle] walltime: invalid offset sec_hi+0(FP); expected sec_hi+4(FP)
-runtime/sys_linux_mipsx.s: [mipsle] nanotime: invalid offset ret_lo+4(FP); expected ret_lo+0(FP)
-runtime/sys_linux_mipsx.s: [mipsle] nanotime: invalid offset ret_hi+0(FP); expected ret_hi+4(FP)
index 8b850683f71d67971d4656dd92941c6656817107..bb327fe9ccadac1282ab9e6954f1e43a2a0637f8 100644 (file)
@@ -886,9 +886,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
        // traceback from goexit1 must hit code range of goexit
        MOVD    R0, R0  // NOP
 
-TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
-       RET
-
 // prepGoExitFrame saves the current TOC pointer (i.e. the TOC pointer for the
 // module containing runtime) to the frame that goexit will execute in when
 // the goroutine exits. It's implemented in assembly mainly because that's the
index e646ea009a080fa84eb8b820c0bcf55f794e90bf..6bab3fd175cbd82f534afaabd0335cb054206deb 100644 (file)
@@ -781,9 +781,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
        // traceback from goexit1 must hit code range of goexit
        BYTE $0x07; BYTE $0x00; // 2-byte nop
 
-TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
-       RET
-
 TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
         // Stores are already ordered on s390x, so this is just a
         // compile barrier.
index 1b2aa3c3b2bf6871bf90024fef4768a254dad1f2..dd14a441cc2bb77bba15bb4227d7b431ecc7ee99 100644 (file)
@@ -110,12 +110,12 @@ clearmt32:
 clearlt256:
        CMPBEQ  R5, $0, done
        ADD     $-1, R5
-       EXRL    $runtime·memclr_s390x_exrl_xc(SB), R5
+       EXRL    $memclr_exrl_xc<>(SB), R5
 done:
        RET
 
 // DO NOT CALL - target for exrl (execute relative long) instruction.
-TEXT runtime·memclr_s390x_exrl_xc(SB),NOSPLIT|NOFRAME,$0-0
+TEXT memclr_exrl_xc<>(SB),NOSPLIT|NOFRAME,$0-0
        XC      $1, 0(R4), 0(R4)
        MOVD    $0, 0(R0)
        RET
index 94d8be5a47346677ff94d7ba44f4888f31905a70..4ce98b0a95274a0143f5097ecbdeaf6e2b9d0327 100644 (file)
@@ -66,7 +66,7 @@ forwards_fast:
 forwards_small:
        CMPBEQ  R5, $0, done
        ADD     $-1, R5
-       EXRL    $runtime·memmove_s390x_exrl_mvc(SB), R5
+       EXRL    $memmove_exrl_mvc<>(SB), R5
        RET
 
 move0to3:
@@ -182,7 +182,7 @@ done:
        RET
 
 // DO NOT CALL - target for exrl (execute relative long) instruction.
-TEXT runtime·memmove_s390x_exrl_mvc(SB),NOSPLIT|NOFRAME,$0-0
+TEXT memmove_exrl_mvc<>(SB),NOSPLIT|NOFRAME,$0-0
        MVC     $1, 0(R4), 0(R6)
        MOVD    R0, 0(R0)
        RET
diff --git a/src/runtime/stubs_arm64.go b/src/runtime/stubs_arm64.go
new file mode 100644 (file)
index 0000000..44c566e
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package runtime
+
+// Called from assembly only; declared for go vet.
+func load_g()
+func save_g()
diff --git a/src/runtime/stubs_mips64x.go b/src/runtime/stubs_mips64x.go
new file mode 100644 (file)
index 0000000..4e62c1c
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build mips64 mips64le
+
+package runtime
+
+// Called from assembly only; declared for go vet.
+func load_g()
+func save_g()
diff --git a/src/runtime/stubs_mipsx.go b/src/runtime/stubs_mipsx.go
new file mode 100644 (file)
index 0000000..707b295
--- /dev/null
@@ -0,0 +1,11 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build mips mipsle
+
+package runtime
+
+// Called from assembly only; declared for go vet.
+func load_g()
+func save_g()
diff --git a/src/runtime/stubs_ppc64x.go b/src/runtime/stubs_ppc64x.go
new file mode 100644 (file)
index 0000000..26f5bb2
--- /dev/null
@@ -0,0 +1,12 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build ppc64 ppc64le
+
+package runtime
+
+// Called from assembly only; declared for go vet.
+func load_g()
+func save_g()
+func reginit()
diff --git a/src/runtime/stubs_s390x.go b/src/runtime/stubs_s390x.go
new file mode 100644 (file)
index 0000000..44c566e
--- /dev/null
@@ -0,0 +1,9 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package runtime
+
+// Called from assembly only; declared for go vet.
+func load_g()
+func save_g()
index 9e1a95f31ea8d26ac1d052e0643ae422f7a07499..9561e11d28d9461fff44653d1cfbf78d9b4e3dff 100644 (file)
@@ -15,7 +15,7 @@
 #include "asm_ppc64x.h"
 
 // This function calls a C function with the function descriptor in R12
-TEXT runtime·callCfunction(SB),       NOSPLIT|NOFRAME,$0
+TEXT callCfunction<>(SB),      NOSPLIT|NOFRAME,$0
        MOVD    0(R12), R12
        MOVD    R2, 40(R1)
        MOVD    0(R12), R0
@@ -31,12 +31,12 @@ TEXT runtime·callCfunction(SB),    NOSPLIT|NOFRAME,$0
 // It reserves a stack of 288 bytes for the C function.
 // NOT USING GO CALLING CONVENTION
 // runtime.asmsyscall6 is a function descriptor to the real asmsyscall6.
-DATA   runtime·asmsyscall6+0(SB)/8, $runtime·_asmsyscall6(SB)
+DATA   runtime·asmsyscall6+0(SB)/8, $asmsyscall6<>(SB)
 DATA   runtime·asmsyscall6+8(SB)/8, $TOC(SB)
 DATA   runtime·asmsyscall6+16(SB)/8, $0
 GLOBL  runtime·asmsyscall6(SB), NOPTR, $24
 
-TEXT runtime·_asmsyscall6(SB),NOSPLIT,$256
+TEXT asmsyscall6<>(SB),NOSPLIT,$256
        MOVD    R3, 48(R1) // Save libcall for later
        MOVD    libcall_fn(R3), R12
        MOVD    libcall_args(R3), R9
@@ -46,7 +46,7 @@ TEXT runtime·_asmsyscall6(SB),NOSPLIT,$256
        MOVD    24(R9), R6
        MOVD    32(R9), R7
        MOVD    40(R9), R8
-       BL      runtime·callCfunction(SB)
+       BL      callCfunction<>(SB)
 
        // Restore R0 and TOC
        XOR     R0, R0
@@ -90,15 +90,15 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
 
 
 // runtime.sigtramp is a function descriptor to the real sigtramp.
-DATA   runtime·sigtramp+0(SB)/8, $runtime·_sigtramp(SB)
+DATA   runtime·sigtramp+0(SB)/8, $sigtramp<>(SB)
 DATA   runtime·sigtramp+8(SB)/8, $TOC(SB)
 DATA   runtime·sigtramp+16(SB)/8, $0
 GLOBL  runtime·sigtramp(SB), NOPTR, $24
 
-// This funcion must not have any frame as we want to control how
+// This function must not have any frame as we want to control how
 // every registers are used.
 // TODO(aix): Implement SetCgoTraceback handler.
-TEXT runtime·_sigtramp(SB),NOSPLIT|NOFRAME,$0
+TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0
        MOVD    LR, R0
        MOVD    R0, 16(R1)
        // initialize essential registers (just in case)
@@ -189,12 +189,12 @@ exit:
        BR (LR)
 
 // runtime.tstart is a function descriptor to the real tstart.
-DATA   runtime·tstart+0(SB)/8, $runtime·_tstart(SB)
+DATA   runtime·tstart+0(SB)/8, $tstart<>(SB)
 DATA   runtime·tstart+8(SB)/8, $TOC(SB)
 DATA   runtime·tstart+16(SB)/8, $0
 GLOBL  runtime·tstart(SB), NOPTR, $24
 
-TEXT runtime·_tstart(SB),NOSPLIT,$0
+TEXT tstart<>(SB),NOSPLIT,$0
        XOR      R0, R0 // reset R0
 
        // set g
index ee9f9303c7d8624c3762c1b832177808accab148..6e539fbc6f1123efdf28941782cf3cfe19f28e76 100644 (file)
@@ -182,12 +182,13 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12
        SYSCALL
        MOVW    4(R29), R3      // sec
        MOVW    8(R29), R5      // nsec
+       MOVW    $sec+0(FP), R6
 #ifdef GOARCH_mips
-       MOVW    R3, sec_lo+4(FP)
-       MOVW    R0, sec_hi+0(FP)
+       MOVW    R3, 4(R6)
+       MOVW    R0, 0(R6)
 #else
-       MOVW    R3, sec_lo+0(FP)
-       MOVW    R0, sec_hi+4(FP)
+       MOVW    R3, 0(R6)
+       MOVW    R0, 4(R6)
 #endif
        MOVW    R5, nsec+8(FP)
        RET
@@ -206,17 +207,18 @@ TEXT runtime·nanotime(SB),NOSPLIT,$8-8
        MOVW    LO, R3
        ADDU    R5, R3
        SGTU    R5, R3, R4
+       MOVW    $ret+0(FP), R6
 #ifdef GOARCH_mips
-       MOVW    R3, ret_lo+4(FP)
+       MOVW    R3, 4(R6)
 #else
-       MOVW    R3, ret_lo+0(FP)
+       MOVW    R3, 0(R6)
 #endif
        MOVW    HI, R3
        ADDU    R4, R3
 #ifdef GOARCH_mips
-       MOVW    R3, ret_hi+0(FP)
+       MOVW    R3, 0(R6)
 #else
-       MOVW    R3, ret_hi+4(FP)
+       MOVW    R3, 4(R6)
 #endif
        RET
 
@@ -369,6 +371,7 @@ TEXT runtime·clone(SB),NOSPLIT|NOFRAME,$0-24
 
        // In child, on new stack.
        // Check that SP is as we expect
+       NOP     R29     // tell vet R29/SP changed - stop checking offsets
        MOVW    12(R29), R16
        MOVW    $1234, R1
        BEQ     R16, R1, 2(PC)
index f1515ec41be5e2ef64aeda14ff13721fedc5a460..13d23156bdbbe861631745f8befa934b3acc04f2 100644 (file)
@@ -285,16 +285,19 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
        MOVD    24(R1), R2
        RET
 
+TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
+       RET
+
 #ifdef GOARCH_ppc64le
 // ppc64le doesn't need function descriptors
 TEXT runtime·sigtramp(SB),NOSPLIT,$64
 #else
 // function descriptor for the real sigtramp
 TEXT runtime·sigtramp(SB),NOSPLIT|NOFRAME,$0
-       DWORD   $runtime·_sigtramp(SB)
+       DWORD   $sigtramp<>(SB)
        DWORD   $0
        DWORD   $0
-TEXT runtime·_sigtramp(SB),NOSPLIT,$64
+TEXT sigtramp<>(SB),NOSPLIT,$64
 #endif
        // initialize essential registers (just in case)
        BL      runtime·reginit(SB)
@@ -410,11 +413,11 @@ sigtrampnog:
 #else
 // function descriptor for the real sigtramp
 TEXT runtime·cgoSigtramp(SB),NOSPLIT|NOFRAME,$0
-       DWORD   $runtime·_cgoSigtramp(SB)
+       DWORD   $cgoSigtramp<>(SB)
        DWORD   $0
        DWORD   $0
-TEXT runtime·_cgoSigtramp(SB),NOSPLIT,$0
-       JMP     runtime·_sigtramp(SB)
+TEXT cgoSigtramp<>(SB),NOSPLIT,$0
+       JMP     sigtramp<>(SB)
 #endif
 
 TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0
index d7ee39112623c9eb4450e91a8db86ae25d698c1d..58b36dff0aa9bd5d0aebb346dfba3dbcbdbd7711 100644 (file)
@@ -222,6 +222,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
        BL      R5
        RET
 
+TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
+       RET
+
 TEXT runtime·sigtramp(SB),NOSPLIT,$64
        // initialize essential registers (just in case)
        XOR     R0, R0