cmd/link, plugin: use full plugin path for symbols
Plumb the import path of a plugin package through to the linker, and
use it as the prefix on the exported symbol names.
Before this we used the basename of the plugin file as the prefix,
which could conflict and result in multiple loaded plugins sharing
symbols that are distinct.
Fixes #17155
Fixes #17579
Change-Id: I7ce966ca82d04e8507c0bcb8ea4ad946809b1ef5
Reviewed-on: https://go-review.googlesource.com/32355
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/src/plugin/plugin.go b/src/plugin/plugin.go
index 93ae23f..e812a2f 100644
--- a/src/plugin/plugin.go
+++ b/src/plugin/plugin.go
@@ -18,9 +18,9 @@
// Plugin is a loaded Go plugin.
type Plugin struct {
- name string
- loaded chan struct{} // closed when loaded
- syms map[string]interface{}
+ pluginpath string
+ loaded chan struct{} // closed when loaded
+ syms map[string]interface{}
}
// Open opens a Go plugin.