Commit 6096b85b authored by Austin Clements's avatar Austin Clements

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: default avatarIan Lance Taylor <iant@golang.org>
parent ef7ce57a
...@@ -35,7 +35,7 @@ func _runtime_cgocallback(unsafe.Pointer, unsafe.Pointer, uintptr, uintptr) ...@@ -35,7 +35,7 @@ func _runtime_cgocallback(unsafe.Pointer, unsafe.Pointer, uintptr, uintptr)
// /* The function call will not return. */ // /* The function call will not return. */
//go:linkname _runtime_cgo_panic_internal runtime._cgo_panic_internal //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:linkname _cgo_panic _cgo_panic
//go:cgo_export_static _cgo_panic //go:cgo_export_static _cgo_panic
...@@ -43,7 +43,12 @@ var _runtime_cgo_panic_internal byte ...@@ -43,7 +43,12 @@ var _runtime_cgo_panic_internal byte
//go:nosplit //go:nosplit
//go:norace //go:norace
func _cgo_panic(a unsafe.Pointer, n int32) { 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 //go:cgo_import_static x_cgo_init
......
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