aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/symtab.go
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2017-09-02 12:05:35 -0400
committerDavid Crawshaw <crawshaw@golang.org>2017-09-09 16:26:33 +0000
commitd8ae2156fe08f31f9b20a79b6971638c5bf203b5 (patch)
tree3619d960bfd11ddf4ea45fc60f6c30048f8bab55 /src/runtime/symtab.go
parent4e2ef7f7f9a3351c3774148c40fe0d7f12403da5 (diff)
downloadgo-d8ae2156fe08f31f9b20a79b6971638c5bf203b5.tar.gz
go-d8ae2156fe08f31f9b20a79b6971638c5bf203b5.zip
runtime, plugin: error not throw on duplicate open
Along the way, track bad modules. Make sure they don't end up on the active modules list, and aren't accidentally reprocessed as new plugins. Fixes #19004 Change-Id: I8a5e7bb11f572f7b657a97d521a7f84822a35c07 Reviewed-on: https://go-review.googlesource.com/61171 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/symtab.go')
-rw-r--r--src/runtime/symtab.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index e1b41ca4ff..4a68f4eaa0 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -338,8 +338,8 @@ const (
// moduledata records information about the layout of the executable
// image. It is written by the linker. Any changes here must be
// matched changes to the code in cmd/internal/ld/symtab.go:symtab.
-// moduledata is stored in read-only memory; none of the pointers here
-// are visible to the garbage collector.
+// moduledata is stored in statically allocated non-pointer memory;
+// none of the pointers here are visible to the garbage collector.
type moduledata struct {
pclntable []byte
ftab []functab
@@ -371,6 +371,8 @@ type moduledata struct {
typemap map[typeOff]*_type // offset to *_rtype in previous module
+ bad bool // module failed to load and should be ignored
+
next *moduledata
}
@@ -443,6 +445,9 @@ func activeModules() []*moduledata {
func modulesinit() {
modules := new([]*moduledata)
for md := &firstmoduledata; md != nil; md = md.next {
+ if md.bad {
+ continue
+ }
*modules = append(*modules, md)
if md.gcdatamask == (bitvector{}) {
md.gcdatamask = progToPointerMask((*byte)(unsafe.Pointer(md.gcdata)), md.edata-md.data)