bytedance / sonic

A blazingly fast JSON serializing & deserializing library
Apache License 2.0
6.54k stars 322 forks source link

Go is going to lock down future uses of `linkname` #637

Open HeRaNO opened 1 month ago

HeRaNO commented 1 month ago

As is shown in https://github.com/golang/go/issues/67401, Golang is going to lock down future uses of linkname and add sonic to the hall of shame due to the huge amounts of linkname use.

So maybe we need a -ldflags=-checklinkname=0 to make the compiling stage happy on Go 1.23. Or we can make a huge change to avoid using linkname.

Related CL:

liuq19 commented 1 month ago

Thanks much, we will investigate that

stefanb commented 1 week ago

The issue has already manifested when trying to build with Go 1.23 rc1 in homebrew:

rsc commented 1 week ago

Hi. bytedance/sonic is widely used enough that we want to keep it working without changes, although of course we would be happy to see these linknames cleaned up in the future. We tried to allowlist all the symbols that bytedance/sonic needed. It looks like maybe we missed a couple? If you can identify the set of names we missed and file an issue in golang/go, I'd appreciate it. Thank you!

AsterDY commented 1 week ago

Hi. bytedance/sonic is widely used enough that we want to keep it working without changes, although of course we would be happy to see these linknames cleaned up in the future. We tried to allowlist all the symbols that bytedance/sonic needed. It looks like maybe we missed a couple? If you can identify the set of names we missed and file an issue in golang/go, I'd appreciate it. Thank you!

@rsc Thx. After we manually move and copy some codes, the Go 1.23 compiler can build now - .https://github.com/bytedance/sonic/pull/662. However, some tests failed, perhaps due to the change of behavior of some links -- As usual . If the Go team can build a notification mechanism to let us know which internal API we are using has changed, we will appreciate it a lot! It will save us a lot of time to match the new version.

rsc commented 1 week ago

Thanks very much for the Go 1.23 fixes @AsterDY. We did not see the prof things you were changing via assembly.

In general the linknames that we have added for Go 1.23 will be left alone and not changed in the future, now that they are documented in our code base as being depended on by other projects. So ideally you should not need to update sonic again for Go 1.24 or future releases. Or at least you should not need to update them quite so often.

AsterDY commented 1 week ago

Thanks very much for the Go 1.23 fixes @AsterDY. We did not see the prof things you were changing via assembly.

In general the linknames that we have added for Go 1.23 will be left alone and not changed in the future, now that they are documented in our code base as being depended on by other projects. So ideally you should not need to update sonic again for Go 1.24 or future releases. Or at least you should not need to update them quite so often.

BTW, is it possible to build sonic on Go1.23.rc2? @rsc