mirror of https://github.com/golang/go.git
runtime: avoid variable/function alias on runtime._cgo_panic_internal
The symbol runtime._cgo_panic_internal is defined both as a function in package runtime and as a (linknamed) variable in package runtime/cgo. Since we're introducing function ABIs, this is going to cause problems with resolving the ABI-marked function symbol with the unmarked data symbol. It's also confusing. Fix this by declaring runtime._cgo_panic_internal as a function in runtime/cgo as well and extracting the PC from the function object. For #27539. Change-Id: I148a458a600cf9e57791cf4cbe92e79bddbf58d4 Reviewed-on: https://go-review.googlesource.com/c/146821 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
ef7ce57ac2
commit
6096b85b13
|
|
@ -35,7 +35,7 @@ func _runtime_cgocallback(unsafe.Pointer, unsafe.Pointer, uintptr, uintptr)
|
|||
// /* The function call will not return. */
|
||||
|
||||
//go:linkname _runtime_cgo_panic_internal runtime._cgo_panic_internal
|
||||
var _runtime_cgo_panic_internal byte
|
||||
func _runtime_cgo_panic_internal(p *byte)
|
||||
|
||||
//go:linkname _cgo_panic _cgo_panic
|
||||
//go:cgo_export_static _cgo_panic
|
||||
|
|
@ -43,7 +43,12 @@ var _runtime_cgo_panic_internal byte
|
|||
//go:nosplit
|
||||
//go:norace
|
||||
func _cgo_panic(a unsafe.Pointer, n int32) {
|
||||
_runtime_cgocallback(unsafe.Pointer(&_runtime_cgo_panic_internal), a, uintptr(n), 0)
|
||||
f := _runtime_cgo_panic_internal
|
||||
type funcval struct {
|
||||
pc unsafe.Pointer
|
||||
}
|
||||
fv := *(**funcval)(unsafe.Pointer(&f))
|
||||
_runtime_cgocallback(fv.pc, a, uintptr(n), 0)
|
||||
}
|
||||
|
||||
//go:cgo_import_static x_cgo_init
|
||||
|
|
|
|||
Loading…
Reference in New Issue