aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2024-02-20 15:05:29 -0500
committerCherry Mui <cherryyz@google.com>2024-02-20 22:40:04 +0000
commit290835298067014e906c540d64dcaa706d66b2ce (patch)
tree37c5bf08b4df0ebe3e7b9de2df4135ae28102d43 /src
parent5428cc4f148bec34987781137ccd30494a99ad15 (diff)
downloadgo-290835298067014e906c540d64dcaa706d66b2ce.tar.xz
cmd/compile: make jump table symbol static
The jump table symbol is accessed only from the function symbol (in the same package), so it can be static. Also, if the function is DUPOK and it is, somehow, compiled differently in two different packages, the linker must choose the jump table symbol associated to the function symbol it chose. Currently the jump table symbol is DUPOK, so that is not guaranteed. Making it static will guarantee that, as each copy of the function symbol refers to its own jump table symbol. For #65783. Change-Id: I27e051d01ef585d07700b75d4dfac5768f16441e Reviewed-on: https://go-review.googlesource.com/c/go/+/565535 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/ssa/rewrite.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go
index db21246446..d3ddfbfab2 100644
--- a/src/cmd/compile/internal/ssa/rewrite.go
+++ b/src/cmd/compile/internal/ssa/rewrite.go
@@ -2131,8 +2131,8 @@ func logicFlags32(x int32) flagConstant {
func makeJumpTableSym(b *Block) *obj.LSym {
s := base.Ctxt.Lookup(fmt.Sprintf("%s.jump%d", b.Func.fe.Func().LSym.Name, b.ID))
- s.Set(obj.AttrDuplicateOK, true)
- s.Set(obj.AttrLocal, true)
+ // The jump table symbol is accessed only from the function symbol.
+ s.Set(obj.AttrStatic, true)
return s
}