mirror of
https://github.com/golang/go
synced 2024-11-11 23:40:22 -07:00
runtime: mark stdcallN functions cgo_unsafe_args
These functions take the address of an argument and expect to be able to reach later arguments from that pointer. This means they must be laid out sequentially in memory (using ABI0) and all arguments must be live even though they don't all appear to be referenced. This is exactly what go:cgo_unsafe_args does. Without this, GOEXPERIMENT=regabi,regabiargs on windows/amd64 crashes on runtime startup because the stdcall functions are called with their arguments in registers, so taking the address of one of them has no bearing on the memory locations of the following arguments. With this, GOEXPERIMENT=regabi,regabiargs on windows/amd64 passes all.bash. For #40724. Change-Id: I4a4d6a913f85799b43f61c234d21ebb113a9b527 Reviewed-on: https://go-review.googlesource.com/c/go/+/310733 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
0613c748e8
commit
639cb1b629
@ -1084,6 +1084,7 @@ func stdcall0(fn stdFunction) uintptr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
|
//go:cgo_unsafe_args
|
||||||
func stdcall1(fn stdFunction, a0 uintptr) uintptr {
|
func stdcall1(fn stdFunction, a0 uintptr) uintptr {
|
||||||
mp := getg().m
|
mp := getg().m
|
||||||
mp.libcall.n = 1
|
mp.libcall.n = 1
|
||||||
@ -1092,6 +1093,7 @@ func stdcall1(fn stdFunction, a0 uintptr) uintptr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
|
//go:cgo_unsafe_args
|
||||||
func stdcall2(fn stdFunction, a0, a1 uintptr) uintptr {
|
func stdcall2(fn stdFunction, a0, a1 uintptr) uintptr {
|
||||||
mp := getg().m
|
mp := getg().m
|
||||||
mp.libcall.n = 2
|
mp.libcall.n = 2
|
||||||
@ -1100,6 +1102,7 @@ func stdcall2(fn stdFunction, a0, a1 uintptr) uintptr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
|
//go:cgo_unsafe_args
|
||||||
func stdcall3(fn stdFunction, a0, a1, a2 uintptr) uintptr {
|
func stdcall3(fn stdFunction, a0, a1, a2 uintptr) uintptr {
|
||||||
mp := getg().m
|
mp := getg().m
|
||||||
mp.libcall.n = 3
|
mp.libcall.n = 3
|
||||||
@ -1108,6 +1111,7 @@ func stdcall3(fn stdFunction, a0, a1, a2 uintptr) uintptr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
|
//go:cgo_unsafe_args
|
||||||
func stdcall4(fn stdFunction, a0, a1, a2, a3 uintptr) uintptr {
|
func stdcall4(fn stdFunction, a0, a1, a2, a3 uintptr) uintptr {
|
||||||
mp := getg().m
|
mp := getg().m
|
||||||
mp.libcall.n = 4
|
mp.libcall.n = 4
|
||||||
@ -1116,6 +1120,7 @@ func stdcall4(fn stdFunction, a0, a1, a2, a3 uintptr) uintptr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
|
//go:cgo_unsafe_args
|
||||||
func stdcall5(fn stdFunction, a0, a1, a2, a3, a4 uintptr) uintptr {
|
func stdcall5(fn stdFunction, a0, a1, a2, a3, a4 uintptr) uintptr {
|
||||||
mp := getg().m
|
mp := getg().m
|
||||||
mp.libcall.n = 5
|
mp.libcall.n = 5
|
||||||
@ -1124,6 +1129,7 @@ func stdcall5(fn stdFunction, a0, a1, a2, a3, a4 uintptr) uintptr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
|
//go:cgo_unsafe_args
|
||||||
func stdcall6(fn stdFunction, a0, a1, a2, a3, a4, a5 uintptr) uintptr {
|
func stdcall6(fn stdFunction, a0, a1, a2, a3, a4, a5 uintptr) uintptr {
|
||||||
mp := getg().m
|
mp := getg().m
|
||||||
mp.libcall.n = 6
|
mp.libcall.n = 6
|
||||||
@ -1132,6 +1138,7 @@ func stdcall6(fn stdFunction, a0, a1, a2, a3, a4, a5 uintptr) uintptr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
|
//go:cgo_unsafe_args
|
||||||
func stdcall7(fn stdFunction, a0, a1, a2, a3, a4, a5, a6 uintptr) uintptr {
|
func stdcall7(fn stdFunction, a0, a1, a2, a3, a4, a5, a6 uintptr) uintptr {
|
||||||
mp := getg().m
|
mp := getg().m
|
||||||
mp.libcall.n = 7
|
mp.libcall.n = 7
|
||||||
|
Loading…
Reference in New Issue
Block a user