]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: disallow linkname referring to instantiations
authorCherry Mui <cherryyz@google.com>
Wed, 15 May 2024 02:34:58 +0000 (22:34 -0400)
committerCherry Mui <cherryyz@google.com>
Wed, 15 May 2024 19:27:25 +0000 (19:27 +0000)
commit849770dec9191475ffed23f0d0985d8222c51e53
treed2e1c10887c3d9f4044901defaff5c5a78044511
parentbf0b605dfbc36b3555eef3315b15facca1c08bdb
cmd/compile: disallow linkname referring to instantiations

Linknaming an instantiated generic symbol isn't particularly
useful: it doesn't guarantee the instantiation exists, and the
instantiated symbol name may be subject to change. Checked with a
large code corpus, currently there is no occurrance of linkname
to an instantiated generic symbol (or symbol with a bracket in its
name). This also suggests that it is not very useful. Linkname is
already an unsafe mechanism. We don't need to allow it to do more
unsafe things without justification.

Change-Id: Ifaa20c98166b28a9d7dc3290c013c2b5bb7682e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/585458
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/noder/writer.go
test/linkname3.go