]> Cypherpunks repositories - gostls13.git/commit
cmd/link: disallow linkname of runtime.addmoduledata
authorzuojunwei.1024 <zuojunwei.1024@bytedance.com>
Thu, 28 Aug 2025 09:32:09 +0000 (17:32 +0800)
committerWayne Zuo <wdvxdr1123@gmail.com>
Fri, 29 Aug 2025 16:36:19 +0000 (09:36 -0700)
commit9f6936b8da81672cebcfa7ac3d6edddf9f1a5d65
treecfb6da5515313f6c16e9f6c4a93def1df878bc04
parent89d41d254a758f9b5e554761c92508220f4342a5
cmd/link: disallow linkname of runtime.addmoduledata

Although a comment on addmoduledata warns that it should not be
called from Go code, the linker still allow it to be accessed via
go:linkname. Using linkname on this function will cause a linker
crash when building with buildmode=plugin.

Fixes #75180

Change-Id: Ib72c367a8afaef712ca5e29b1d0a4fc98ed8f40f
Reviewed-on: https://go-review.googlesource.com/c/go/+/699655
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/link/internal/loader/loader.go
src/cmd/link/link_test.go
src/cmd/link/testdata/linkname/addmoduledata.go [new file with mode: 0644]