Skip to content

Commit 3b4bccc

Browse files
committed
syscall: add GO_ARGS to Go-called assembly
Fixes sporadic linux/386 build failure (untyped args) and probably some others we haven't observed yet. Fixes #8727. TBR=iant R=golang-codereviews CC=bradfitz, golang-codereviews, iant, khr, r https://golang.org/cl/143930043
1 parent e8a74dc commit 3b4bccc

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

src/syscall/asm_linux_386.s

+3
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ ok2:
119119
// func socketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
120120
// Kernel interface gets call sub-number and pointer to a0.
121121
TEXT ·socketcall(SB),NOSPLIT,$0-36
122+
GO_ARGS
122123
CALL runtime·entersyscall(SB)
123124
MOVL $SYS_SOCKETCALL, AX // syscall entry
124125
MOVL 4(SP), BX // socket call number
@@ -143,6 +144,7 @@ oksock:
143144
// func rawsocketcall(call int, a0, a1, a2, a3, a4, a5 uintptr) (n int, errno int)
144145
// Kernel interface gets call sub-number and pointer to a0.
145146
TEXT ·rawsocketcall(SB),NOSPLIT,$0-36
147+
GO_ARGS
146148
MOVL $SYS_SOCKETCALL, AX // syscall entry
147149
MOVL 4(SP), BX // socket call number
148150
LEAL 8(SP), CX // pointer to call arguments
@@ -168,6 +170,7 @@ oksock1:
168170
// Underlying system call is
169171
// llseek(int fd, int offhi, int offlo, int64 *result, int whence)
170172
TEXT ·seek(SB),NOSPLIT,$0-28
173+
GO_ARGS
171174
CALL runtime·entersyscall(SB)
172175
MOVL $SYS__LLSEEK, AX // syscall entry
173176
MOVL 4(SP), BX // fd

src/syscall/asm_linux_amd64.s

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ ok2:
116116
RET
117117

118118
TEXT ·gettimeofday(SB),NOSPLIT,$0-16
119+
GO_ARGS
119120
MOVQ 8(SP), DI
120121
MOVQ $0, SI
121122
MOVQ runtime·__vdso_gettimeofday_sym(SB), AX

src/syscall/asm_linux_arm.s

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ ok2:
111111
// Underlying system call is
112112
// llseek(int fd, int offhi, int offlo, int64 *result, int whence)
113113
TEXT ·seek(SB),NOSPLIT,$0-32
114+
GO_ARGS
114115
BL runtime·entersyscall(SB)
115116
MOVW $SYS__LLSEEK, R7 // syscall entry
116117
MOVW 4(SP), R0 // fd

src/syscall/asm_plan9_386.s

+3
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
132132

133133
//func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
134134
TEXT ·seek(SB),NOSPLIT,$0-36
135+
GO_ARGS
135136
LEAL newoffset+24(SP), AX
136137
MOVL AX, placeholder+4(SP)
137138

@@ -163,6 +164,8 @@ copyresult6:
163164
//func exit(code int)
164165
// Import runtime·exit for cleanly exiting.
165166
TEXT ·exit(SB),NOSPLIT,$4-4
167+
GO_ARGS
168+
NO_LOCAL_POINTERS
166169
MOVL code+0(FP), AX
167170
MOVL AX, 0(SP)
168171
CALL runtime·exit(SB)

src/syscall/asm_plan9_amd64.s

+3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
131131

132132
//func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
133133
TEXT ·seek(SB),NOSPLIT,$0-56
134+
GO_ARGS
134135
LEAQ newoffset+40(SP), AX
135136
MOVQ AX, placeholder+8(SP)
136137

@@ -161,6 +162,8 @@ copyresult6:
161162
//func exit(code int)
162163
// Import runtime·exit for cleanly exiting.
163164
TEXT ·exit(SB),NOSPLIT,$8-8
165+
GO_ARGS
166+
NO_LOCAL_POINTERS
164167
MOVQ code+0(FP), AX
165168
MOVQ AX, 0(SP)
166169
CALL runtime·exit(SB)

0 commit comments

Comments
 (0)