Commit 49f62af7 authored by Russ Cox's avatar Russ Cox

runtime: fix vet complaints for linux/arm64, linux/mips*, linux/ppc64*, linux/s390x

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: default avatarAustin Clements <austin@google.com>
parent 1ea76443
// 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
// 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
// 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
// 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)
// 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)
...@@ -886,9 +886,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0 ...@@ -886,9 +886,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
// traceback from goexit1 must hit code range of goexit // traceback from goexit1 must hit code range of goexit
MOVD R0, R0 // NOP 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 // 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 // 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 // the goroutine exits. It's implemented in assembly mainly because that's the
......
...@@ -781,9 +781,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0 ...@@ -781,9 +781,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
// traceback from goexit1 must hit code range of goexit // traceback from goexit1 must hit code range of goexit
BYTE $0x07; BYTE $0x00; // 2-byte nop BYTE $0x07; BYTE $0x00; // 2-byte nop
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
RET
TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0 TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
// Stores are already ordered on s390x, so this is just a // Stores are already ordered on s390x, so this is just a
// compile barrier. // compile barrier.
......
...@@ -110,12 +110,12 @@ clearmt32: ...@@ -110,12 +110,12 @@ clearmt32:
clearlt256: clearlt256:
CMPBEQ R5, $0, done CMPBEQ R5, $0, done
ADD $-1, R5 ADD $-1, R5
EXRL $runtime·memclr_s390x_exrl_xc(SB), R5 EXRL $memclr_exrl_xc<>(SB), R5
done: done:
RET RET
// DO NOT CALL - target for exrl (execute relative long) instruction. // 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) XC $1, 0(R4), 0(R4)
MOVD $0, 0(R0) MOVD $0, 0(R0)
RET RET
......
...@@ -66,7 +66,7 @@ forwards_fast: ...@@ -66,7 +66,7 @@ forwards_fast:
forwards_small: forwards_small:
CMPBEQ R5, $0, done CMPBEQ R5, $0, done
ADD $-1, R5 ADD $-1, R5
EXRL $runtime·memmove_s390x_exrl_mvc(SB), R5 EXRL $memmove_exrl_mvc<>(SB), R5
RET RET
move0to3: move0to3:
...@@ -182,7 +182,7 @@ done: ...@@ -182,7 +182,7 @@ done:
RET RET
// DO NOT CALL - target for exrl (execute relative long) instruction. // 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) MVC $1, 0(R4), 0(R6)
MOVD R0, 0(R0) MOVD R0, 0(R0)
RET RET
......
// 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()
// 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()
// 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()
// 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()
// 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()
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "asm_ppc64x.h" #include "asm_ppc64x.h"
// This function calls a C function with the function descriptor in R12 // 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 0(R12), R12
MOVD R2, 40(R1) MOVD R2, 40(R1)
MOVD 0(R12), R0 MOVD 0(R12), R0
...@@ -31,12 +31,12 @@ TEXT runtime·callCfunction(SB), NOSPLIT|NOFRAME,$0 ...@@ -31,12 +31,12 @@ TEXT runtime·callCfunction(SB), NOSPLIT|NOFRAME,$0
// It reserves a stack of 288 bytes for the C function. // It reserves a stack of 288 bytes for the C function.
// NOT USING GO CALLING CONVENTION // NOT USING GO CALLING CONVENTION
// runtime.asmsyscall6 is a function descriptor to the real asmsyscall6. // 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+8(SB)/8, $TOC(SB)
DATA runtime·asmsyscall6+16(SB)/8, $0 DATA runtime·asmsyscall6+16(SB)/8, $0
GLOBL runtime·asmsyscall6(SB), NOPTR, $24 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 R3, 48(R1) // Save libcall for later
MOVD libcall_fn(R3), R12 MOVD libcall_fn(R3), R12
MOVD libcall_args(R3), R9 MOVD libcall_args(R3), R9
...@@ -46,7 +46,7 @@ TEXT runtime·_asmsyscall6(SB),NOSPLIT,$256 ...@@ -46,7 +46,7 @@ TEXT runtime·_asmsyscall6(SB),NOSPLIT,$256
MOVD 24(R9), R6 MOVD 24(R9), R6
MOVD 32(R9), R7 MOVD 32(R9), R7
MOVD 40(R9), R8 MOVD 40(R9), R8
BL runtime·callCfunction(SB) BL callCfunction<>(SB)
// Restore R0 and TOC // Restore R0 and TOC
XOR R0, R0 XOR R0, R0
...@@ -90,15 +90,15 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 ...@@ -90,15 +90,15 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
// runtime.sigtramp is a function descriptor to the real sigtramp. // 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+8(SB)/8, $TOC(SB)
DATA runtime·sigtramp+16(SB)/8, $0 DATA runtime·sigtramp+16(SB)/8, $0
GLOBL runtime·sigtramp(SB), NOPTR, $24 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. // every registers are used.
// TODO(aix): Implement SetCgoTraceback handler. // TODO(aix): Implement SetCgoTraceback handler.
TEXT runtime·_sigtramp(SB),NOSPLIT|NOFRAME,$0 TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0
MOVD LR, R0 MOVD LR, R0
MOVD R0, 16(R1) MOVD R0, 16(R1)
// initialize essential registers (just in case) // initialize essential registers (just in case)
...@@ -189,12 +189,12 @@ exit: ...@@ -189,12 +189,12 @@ exit:
BR (LR) BR (LR)
// runtime.tstart is a function descriptor to the real tstart. // 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+8(SB)/8, $TOC(SB)
DATA runtime·tstart+16(SB)/8, $0 DATA runtime·tstart+16(SB)/8, $0
GLOBL runtime·tstart(SB), NOPTR, $24 GLOBL runtime·tstart(SB), NOPTR, $24
TEXT runtime·_tstart(SB),NOSPLIT,$0 TEXT tstart<>(SB),NOSPLIT,$0
XOR R0, R0 // reset R0 XOR R0, R0 // reset R0
// set g // set g
......
...@@ -182,12 +182,13 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12 ...@@ -182,12 +182,13 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12
SYSCALL SYSCALL
MOVW 4(R29), R3 // sec MOVW 4(R29), R3 // sec
MOVW 8(R29), R5 // nsec MOVW 8(R29), R5 // nsec
MOVW $sec+0(FP), R6
#ifdef GOARCH_mips #ifdef GOARCH_mips
MOVW R3, sec_lo+4(FP) MOVW R3, 4(R6)
MOVW R0, sec_hi+0(FP) MOVW R0, 0(R6)
#else #else
MOVW R3, sec_lo+0(FP) MOVW R3, 0(R6)
MOVW R0, sec_hi+4(FP) MOVW R0, 4(R6)
#endif #endif
MOVW R5, nsec+8(FP) MOVW R5, nsec+8(FP)
RET RET
...@@ -206,17 +207,18 @@ TEXT runtime·nanotime(SB),NOSPLIT,$8-8 ...@@ -206,17 +207,18 @@ TEXT runtime·nanotime(SB),NOSPLIT,$8-8
MOVW LO, R3 MOVW LO, R3
ADDU R5, R3 ADDU R5, R3
SGTU R5, R3, R4 SGTU R5, R3, R4
MOVW $ret+0(FP), R6
#ifdef GOARCH_mips #ifdef GOARCH_mips
MOVW R3, ret_lo+4(FP) MOVW R3, 4(R6)
#else #else
MOVW R3, ret_lo+0(FP) MOVW R3, 0(R6)
#endif #endif
MOVW HI, R3 MOVW HI, R3
ADDU R4, R3 ADDU R4, R3
#ifdef GOARCH_mips #ifdef GOARCH_mips
MOVW R3, ret_hi+0(FP) MOVW R3, 0(R6)
#else #else
MOVW R3, ret_hi+4(FP) MOVW R3, 4(R6)
#endif #endif
RET RET
...@@ -369,6 +371,7 @@ TEXT runtime·clone(SB),NOSPLIT|NOFRAME,$0-24 ...@@ -369,6 +371,7 @@ TEXT runtime·clone(SB),NOSPLIT|NOFRAME,$0-24
// In child, on new stack. // In child, on new stack.
// Check that SP is as we expect // Check that SP is as we expect
NOP R29 // tell vet R29/SP changed - stop checking offsets
MOVW 12(R29), R16 MOVW 12(R29), R16
MOVW $1234, R1 MOVW $1234, R1
BEQ R16, R1, 2(PC) BEQ R16, R1, 2(PC)
......
...@@ -285,16 +285,19 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 ...@@ -285,16 +285,19 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
MOVD 24(R1), R2 MOVD 24(R1), R2
RET RET
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
RET
#ifdef GOARCH_ppc64le #ifdef GOARCH_ppc64le
// ppc64le doesn't need function descriptors // ppc64le doesn't need function descriptors
TEXT runtime·sigtramp(SB),NOSPLIT,$64 TEXT runtime·sigtramp(SB),NOSPLIT,$64
#else #else
// function descriptor for the real sigtramp // function descriptor for the real sigtramp
TEXT runtime·sigtramp(SB),NOSPLIT|NOFRAME,$0 TEXT runtime·sigtramp(SB),NOSPLIT|NOFRAME,$0
DWORD $runtime·_sigtramp(SB) DWORD $sigtramp<>(SB)
DWORD $0 DWORD $0
DWORD $0 DWORD $0
TEXT runtime·_sigtramp(SB),NOSPLIT,$64 TEXT sigtramp<>(SB),NOSPLIT,$64
#endif #endif
// initialize essential registers (just in case) // initialize essential registers (just in case)
BL runtime·reginit(SB) BL runtime·reginit(SB)
...@@ -410,11 +413,11 @@ sigtrampnog: ...@@ -410,11 +413,11 @@ sigtrampnog:
#else #else
// function descriptor for the real sigtramp // function descriptor for the real sigtramp
TEXT runtime·cgoSigtramp(SB),NOSPLIT|NOFRAME,$0 TEXT runtime·cgoSigtramp(SB),NOSPLIT|NOFRAME,$0
DWORD $runtime·_cgoSigtramp(SB) DWORD $cgoSigtramp<>(SB)
DWORD $0 DWORD $0
DWORD $0 DWORD $0
TEXT runtime·_cgoSigtramp(SB),NOSPLIT,$0 TEXT cgoSigtramp<>(SB),NOSPLIT,$0
JMP runtime·_sigtramp(SB) JMP sigtramp<>(SB)
#endif #endif
TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0 TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0
......
...@@ -222,6 +222,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32 ...@@ -222,6 +222,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
BL R5 BL R5
RET RET
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
RET
TEXT runtime·sigtramp(SB),NOSPLIT,$64 TEXT runtime·sigtramp(SB),NOSPLIT,$64
// initialize essential registers (just in case) // initialize essential registers (just in case)
XOR R0, R0 XOR R0, R0
......
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