aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2016-08-25 21:58:45 -0400
committerDavid Crawshaw <crawshaw@golang.org>2016-09-16 14:49:13 +0000
commiteced6754c2f2ce98cb5bacbdbfcbbaa4a6a69d53 (patch)
tree0450fbe9c27799556daef1148c816e3645c61ccc /src/runtime
parent79167bbd9c71017e18836a3e5e40261b57012358 (diff)
downloadgo-eced6754c2f2ce98cb5bacbdbfcbbaa4a6a69d53.tar.xz
cmd/link: -buildmode=plugin support for linux
This CL contains several linker changes to support creating plugins. It collects the exported plugin symbols provided by the compiler and includes them in the moduledata. It treats a binary as being dynamically linked if it imports the plugin package. This lets the dynamic linker de-duplicate symbols. Change-Id: I099b6f38dda26306eba5c41dbe7862f5a5918d95 Reviewed-on: https://go-review.googlesource.com/27820 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/plugin.go13
-rw-r--r--src/runtime/symtab.go2
2 files changed, 15 insertions, 0 deletions
diff --git a/src/runtime/plugin.go b/src/runtime/plugin.go
new file mode 100644
index 0000000000..f5f3aa2e5b
--- /dev/null
+++ b/src/runtime/plugin.go
@@ -0,0 +1,13 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package runtime
+
+// A ptabEntry is generated by the compiler for each exported function
+// and global variable in the main package of a plugin. It is used to
+// initialize the plugin module's symbol map.
+type ptabEntry struct {
+ name nameOff
+ typ typeOff
+}
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 7a37085fab..87b478a885 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -198,6 +198,8 @@ type moduledata struct {
typelinks []int32 // offsets from types
itablinks []*itab
+ ptab []ptabEntry
+
modulename string
modulehashes []modulehash