]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: make jump table symbol local
authorCherry Mui <cherryyz@google.com>
Thu, 21 Jul 2022 22:23:39 +0000 (18:23 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 22 Jul 2022 20:12:19 +0000 (20:12 +0000)
commitc5da4fb7ac5cb7434b41fc9a1df3bee66c7f1a4d
treeb08e68f973f410d1291c00e7fa0cb1f279f730a1
parent774fa58d1d3c9926709e108afdf83af7010bde72
cmd/compile: make jump table symbol local

When using plugins, if the plugin and the main executable both
have the same function, and if it uses jump table, currently the
jump table symbol have the same name so it will be deduplicated by
the dynamic linker. This causes a function in the plugin may (in
the middle of the function) jump to the function with the same name
in the main executable (or vice versa). But the function may be
compiled slightly differently, because the plugin needs to be PIC.
Jumping from the middle of one function to the other will not work.
Avoid this problem by marking the jump table symbol local to a DSO.

Fixes #53989.

Change-Id: I2b573b9dfc22401c8a09ffe9b9ea8bb83d3700ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/418960
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
misc/cgo/testplugin/plugin_test.go
misc/cgo/testplugin/testdata/issue53989/main.go [new file with mode: 0644]
misc/cgo/testplugin/testdata/issue53989/p/p.go [new file with mode: 0644]
misc/cgo/testplugin/testdata/issue53989/plugin.go [new file with mode: 0644]
src/cmd/compile/internal/ssa/rewrite.go