ebitengine / purego

Apache License 2.0
1.94k stars 63 forks source link

confirm all the `//go:linkname` usages to be 'handshake' or 'push' #248

Closed hajimehoshi closed 1 month ago

hajimehoshi commented 1 month ago

Operating System

What feature would you like to be added?

https://github.com/golang/go/issues/67401

IIUC, we can no longer use the 'pull' usage of //go:linkname (i.e., we cannot pull an unexported symbol by //go:linkname that is not pushed by //go:linkname). As we discussed on the Discord server, what we should take care is cgocall and noescape.

Push
//go:linkname _cgo_setenv runtime._cgo_setenv
//go:linkname _cgo_unsetenv runtime._cgo_unsetenv
//go:linkname _cgo_init _cgo_init
//go:linkname _cgo_thread_start _cgo_thread_start
//go:linkname _cgo_notify_runtime_init_done _cgo_notify_runtime_init_done
//go:linkname _cgo_pthread_key_created _cgo_pthread_key_created
//go:linkname _set_crosscall2 runtime.set_crosscall2
//go:linkname _cgo_bindm _cgo_bindm

Pull
//go:linkname runtime_cgocall runtime.cgocall
//go:linkname runtime_noescape runtime.noescape

Why is this needed?

For availability with Go 1.23.

hajimehoshi commented 1 month ago

Duplicated with #247