Skip to content

Commit 49f62af

Browse files
committed
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 <[email protected]> Reviewed-by: Austin Clements <[email protected]>
1 parent 1ea7644 commit 49f62af

18 files changed

+87
-60
lines changed

src/cmd/vet/all/whitelist/aix_ppc64.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/cmd/vet/all/whitelist/arm64.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/cmd/vet/all/whitelist/linux_ppc64x.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/cmd/vet/all/whitelist/mips.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/cmd/vet/all/whitelist/mipsle.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/runtime/asm_ppc64x.s

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -886,9 +886,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
886886
// traceback from goexit1 must hit code range of goexit
887887
MOVD R0, R0 // NOP
888888

889-
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
890-
RET
891-
892889
// prepGoExitFrame saves the current TOC pointer (i.e. the TOC pointer for the
893890
// module containing runtime) to the frame that goexit will execute in when
894891
// the goroutine exits. It's implemented in assembly mainly because that's the

src/runtime/asm_s390x.s

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,6 @@ TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
781781
// traceback from goexit1 must hit code range of goexit
782782
BYTE $0x07; BYTE $0x00; // 2-byte nop
783783

784-
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
785-
RET
786-
787784
TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0
788785
// Stores are already ordered on s390x, so this is just a
789786
// compile barrier.

src/runtime/memclr_s390x.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ clearmt32:
110110
clearlt256:
111111
CMPBEQ R5, $0, done
112112
ADD $-1, R5
113-
EXRL $runtime·memclr_s390x_exrl_xc(SB), R5
113+
EXRL $memclr_exrl_xc<>(SB), R5
114114
done:
115115
RET
116116

117117
// DO NOT CALL - target for exrl (execute relative long) instruction.
118-
TEXT runtime·memclr_s390x_exrl_xc(SB),NOSPLIT|NOFRAME,$0-0
118+
TEXT memclr_exrl_xc<>(SB),NOSPLIT|NOFRAME,$0-0
119119
XC $1, 0(R4), 0(R4)
120120
MOVD $0, 0(R0)
121121
RET

src/runtime/memmove_s390x.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ forwards_fast:
6666
forwards_small:
6767
CMPBEQ R5, $0, done
6868
ADD $-1, R5
69-
EXRL $runtime·memmove_s390x_exrl_mvc(SB), R5
69+
EXRL $memmove_exrl_mvc<>(SB), R5
7070
RET
7171

7272
move0to3:
@@ -182,7 +182,7 @@ done:
182182
RET
183183

184184
// DO NOT CALL - target for exrl (execute relative long) instruction.
185-
TEXT runtime·memmove_s390x_exrl_mvc(SB),NOSPLIT|NOFRAME,$0-0
185+
TEXT memmove_exrl_mvc<>(SB),NOSPLIT|NOFRAME,$0-0
186186
MVC $1, 0(R4), 0(R6)
187187
MOVD R0, 0(R0)
188188
RET

src/runtime/stubs_arm64.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package runtime
6+
7+
// Called from assembly only; declared for go vet.
8+
func load_g()
9+
func save_g()

src/runtime/stubs_mips64x.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build mips64 mips64le
6+
7+
package runtime
8+
9+
// Called from assembly only; declared for go vet.
10+
func load_g()
11+
func save_g()

src/runtime/stubs_mipsx.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build mips mipsle
6+
7+
package runtime
8+
9+
// Called from assembly only; declared for go vet.
10+
func load_g()
11+
func save_g()

src/runtime/stubs_ppc64x.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build ppc64 ppc64le
6+
7+
package runtime
8+
9+
// Called from assembly only; declared for go vet.
10+
func load_g()
11+
func save_g()
12+
func reginit()

src/runtime/stubs_s390x.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package runtime
6+
7+
// Called from assembly only; declared for go vet.
8+
func load_g()
9+
func save_g()

src/runtime/sys_aix_ppc64.s

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "asm_ppc64x.h"
1616

1717
// This function calls a C function with the function descriptor in R12
18-
TEXT runtime·callCfunction(SB), NOSPLIT|NOFRAME,$0
18+
TEXT callCfunction<>(SB), NOSPLIT|NOFRAME,$0
1919
MOVD 0(R12), R12
2020
MOVD R2, 40(R1)
2121
MOVD 0(R12), R0
@@ -31,12 +31,12 @@ TEXT runtime·callCfunction(SB), NOSPLIT|NOFRAME,$0
3131
// It reserves a stack of 288 bytes for the C function.
3232
// NOT USING GO CALLING CONVENTION
3333
// runtime.asmsyscall6 is a function descriptor to the real asmsyscall6.
34-
DATA runtime·asmsyscall6+0(SB)/8, $runtime·_asmsyscall6(SB)
34+
DATA runtime·asmsyscall6+0(SB)/8, $asmsyscall6<>(SB)
3535
DATA runtime·asmsyscall6+8(SB)/8, $TOC(SB)
3636
DATA runtime·asmsyscall6+16(SB)/8, $0
3737
GLOBL runtime·asmsyscall6(SB), NOPTR, $24
3838

39-
TEXT runtime·_asmsyscall6(SB),NOSPLIT,$256
39+
TEXT asmsyscall6<>(SB),NOSPLIT,$256
4040
MOVD R3, 48(R1) // Save libcall for later
4141
MOVD libcall_fn(R3), R12
4242
MOVD libcall_args(R3), R9
@@ -46,7 +46,7 @@ TEXT runtime·_asmsyscall6(SB),NOSPLIT,$256
4646
MOVD 24(R9), R6
4747
MOVD 32(R9), R7
4848
MOVD 40(R9), R8
49-
BL runtime·callCfunction(SB)
49+
BL callCfunction<>(SB)
5050

5151
// Restore R0 and TOC
5252
XOR R0, R0
@@ -90,15 +90,15 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
9090

9191

9292
// runtime.sigtramp is a function descriptor to the real sigtramp.
93-
DATA runtime·sigtramp+0(SB)/8, $runtime·_sigtramp(SB)
93+
DATA runtime·sigtramp+0(SB)/8, $sigtramp<>(SB)
9494
DATA runtime·sigtramp+8(SB)/8, $TOC(SB)
9595
DATA runtime·sigtramp+16(SB)/8, $0
9696
GLOBL runtime·sigtramp(SB), NOPTR, $24
9797

98-
// This funcion must not have any frame as we want to control how
98+
// This function must not have any frame as we want to control how
9999
// every registers are used.
100100
// TODO(aix): Implement SetCgoTraceback handler.
101-
TEXT runtime·_sigtramp(SB),NOSPLIT|NOFRAME,$0
101+
TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0
102102
MOVD LR, R0
103103
MOVD R0, 16(R1)
104104
// initialize essential registers (just in case)
@@ -189,12 +189,12 @@ exit:
189189
BR (LR)
190190

191191
// runtime.tstart is a function descriptor to the real tstart.
192-
DATA runtime·tstart+0(SB)/8, $runtime·_tstart(SB)
192+
DATA runtime·tstart+0(SB)/8, $tstart<>(SB)
193193
DATA runtime·tstart+8(SB)/8, $TOC(SB)
194194
DATA runtime·tstart+16(SB)/8, $0
195195
GLOBL runtime·tstart(SB), NOPTR, $24
196196

197-
TEXT runtime·_tstart(SB),NOSPLIT,$0
197+
TEXT tstart<>(SB),NOSPLIT,$0
198198
XOR R0, R0 // reset R0
199199

200200
// set g

src/runtime/sys_linux_mipsx.s

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,13 @@ TEXT runtime·walltime(SB),NOSPLIT,$8-12
182182
SYSCALL
183183
MOVW 4(R29), R3 // sec
184184
MOVW 8(R29), R5 // nsec
185+
MOVW $sec+0(FP), R6
185186
#ifdef GOARCH_mips
186-
MOVW R3, sec_lo+4(FP)
187-
MOVW R0, sec_hi+0(FP)
187+
MOVW R3, 4(R6)
188+
MOVW R0, 0(R6)
188189
#else
189-
MOVW R3, sec_lo+0(FP)
190-
MOVW R0, sec_hi+4(FP)
190+
MOVW R3, 0(R6)
191+
MOVW R0, 4(R6)
191192
#endif
192193
MOVW R5, nsec+8(FP)
193194
RET
@@ -206,17 +207,18 @@ TEXT runtime·nanotime(SB),NOSPLIT,$8-8
206207
MOVW LO, R3
207208
ADDU R5, R3
208209
SGTU R5, R3, R4
210+
MOVW $ret+0(FP), R6
209211
#ifdef GOARCH_mips
210-
MOVW R3, ret_lo+4(FP)
212+
MOVW R3, 4(R6)
211213
#else
212-
MOVW R3, ret_lo+0(FP)
214+
MOVW R3, 0(R6)
213215
#endif
214216
MOVW HI, R3
215217
ADDU R4, R3
216218
#ifdef GOARCH_mips
217-
MOVW R3, ret_hi+0(FP)
219+
MOVW R3, 0(R6)
218220
#else
219-
MOVW R3, ret_hi+4(FP)
221+
MOVW R3, 4(R6)
220222
#endif
221223
RET
222224

@@ -369,6 +371,7 @@ TEXT runtime·clone(SB),NOSPLIT|NOFRAME,$0-24
369371

370372
// In child, on new stack.
371373
// Check that SP is as we expect
374+
NOP R29 // tell vet R29/SP changed - stop checking offsets
372375
MOVW 12(R29), R16
373376
MOVW $1234, R1
374377
BEQ R16, R1, 2(PC)

src/runtime/sys_linux_ppc64x.s

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,19 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
285285
MOVD 24(R1), R2
286286
RET
287287

288+
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
289+
RET
290+
288291
#ifdef GOARCH_ppc64le
289292
// ppc64le doesn't need function descriptors
290293
TEXT runtime·sigtramp(SB),NOSPLIT,$64
291294
#else
292295
// function descriptor for the real sigtramp
293296
TEXT runtime·sigtramp(SB),NOSPLIT|NOFRAME,$0
294-
DWORD $runtime·_sigtramp(SB)
297+
DWORD $sigtramp<>(SB)
295298
DWORD $0
296299
DWORD $0
297-
TEXT runtime·_sigtramp(SB),NOSPLIT,$64
300+
TEXT sigtramp<>(SB),NOSPLIT,$64
298301
#endif
299302
// initialize essential registers (just in case)
300303
BL runtime·reginit(SB)
@@ -410,11 +413,11 @@ sigtrampnog:
410413
#else
411414
// function descriptor for the real sigtramp
412415
TEXT runtime·cgoSigtramp(SB),NOSPLIT|NOFRAME,$0
413-
DWORD $runtime·_cgoSigtramp(SB)
416+
DWORD $cgoSigtramp<>(SB)
414417
DWORD $0
415418
DWORD $0
416-
TEXT runtime·_cgoSigtramp(SB),NOSPLIT,$0
417-
JMP runtime·_sigtramp(SB)
419+
TEXT cgoSigtramp<>(SB),NOSPLIT,$0
420+
JMP sigtramp<>(SB)
418421
#endif
419422

420423
TEXT runtime·sigprofNonGoWrapper<>(SB),NOSPLIT,$0

src/runtime/sys_linux_s390x.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
222222
BL R5
223223
RET
224224

225+
TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
226+
RET
227+
225228
TEXT runtime·sigtramp(SB),NOSPLIT,$64
226229
// initialize essential registers (just in case)
227230
XOR R0, R0

0 commit comments

Comments
 (0)