Skip to content

Commit 4fe1c06

Browse files
cherrymuibradfitz
authored andcommitted
[release-branch.go1.22] 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. Updates golang#65783. Fixes golang#65818. Change-Id: I27e051d01ef585d07700b75d4dfac5768f16441e Reviewed-on: https://go-review.googlesource.com/c/go/+/565535 Reviewed-by: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]> (cherry picked from commit 2908352) Reviewed-on: https://go-review.googlesource.com/c/go/+/566475
1 parent 05bdd83 commit 4fe1c06

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cmd/compile/internal/ssa/rewrite.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,8 +2131,8 @@ func logicFlags32(x int32) flagConstant {
21312131

21322132
func makeJumpTableSym(b *Block) *obj.LSym {
21332133
s := base.Ctxt.Lookup(fmt.Sprintf("%s.jump%d", b.Func.fe.Func().LSym.Name, b.ID))
2134-
s.Set(obj.AttrDuplicateOK, true)
2135-
s.Set(obj.AttrLocal, true)
2134+
// The jump table symbol is accessed only from the function symbol.
2135+
s.Set(obj.AttrStatic, true)
21362136
return s
21372137
}
21382138

0 commit comments

Comments
 (0)