On Wed, Dec 25, 2024 at 10:34 PM zhengyao xie <jayant...@gmail.com> wrote: > > I would like to ask everyone for your help. In external code, I used > `//go:linkname` directive as follows: > > ```go > //go:linkname runtime_setEventErr runtime.(*pollDesc).setEventErr > func runtime_setEventErr(pd runtimePollDesc, b bool, seq uintptr) > ``` > The `runtime.(*pollDesc).setEventErr` function has been linked using > linkname. It works well before go1.23, but since [go1.23 lock down future > uses of linkname](https://github.com/golang/go/issues/67401), it can't work. > I want to export this function within a private go runtime to remove the > linkname check. How should I modify it? I have tried several ways but none of > them seem to work: > > ```go > //go:linkname setEventErr > func (pd *pollDesc) setEventErr(b bool, seq uintptr) > > //go:linkname (*pollDesc).setEventErr > func (pd *pollDesc) setEventErr(b bool, seq uintptr) > > //go:linkname runtime.(*pollDesc).setEventErr > func (pd *pollDesc) setEventErr(b bool, seq uintptr) > ``` > > ```bash > cd go/src && ./make.bash > ``` > > The error log is: > > ``` > /usr/local/go/src/runtime/netpoll.go:178:3: //go:linkname must refer to > declared function or variable > ```
Build with "go build -ldflags=-checklinkname=0". Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWfsjmwAjdu0sU8DqRdzk0ofvfR9nF1D3wqL7Cw1T%2Brsw%40mail.gmail.com.