]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/obj: disallow linknamed access to builtin symbols
authorCherry Mui <cherryyz@google.com>
Thu, 12 Dec 2024 19:31:45 +0000 (14:31 -0500)
committerCherry Mui <cherryyz@google.com>
Thu, 12 Dec 2024 20:58:47 +0000 (12:58 -0800)
commit14e5093ee56c7e3a807c8924fd2d425cd2b0f376
treecc8a7f0bb8a752b17d85b63217708d8179d1e53c
parentfb764cdad03ae2e500100b691f77cbd0d22b7d9c
cmd/internal/obj: disallow linknamed access to builtin symbols

Currently, a symbol reference is counted as a reference to a
builtin symbol if the name matches a builtin. Usually builtin
references are generated by the compiler. But one could manually
write one with linkname. Since the list of builtin functions are
subject to change from time to time, we don't want users to depend
on their names. So we don't count a linknamed reference as a
builtin reference, and instead, count it as a named reference, so
it is checked by the linker.

Change-Id: Id3543295185c6bbd73a8cff82afb8f9cb4fd6f71
Reviewed-on: https://go-review.googlesource.com/c/go/+/635755
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/internal/obj/sym.go
src/cmd/link/link_test.go
src/cmd/link/testdata/linkname/builtin.go [new file with mode: 0644]