aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/iface.go
diff options
context:
space:
mode:
authorMichael Hudson-Doyle <michael.hudson@canonical.com>2016-10-26 15:57:58 +1300
committerMichael Hudson-Doyle <michael.hudson@canonical.com>2016-10-27 19:13:35 +0000
commit8b07ec20f7a971edce9eaf413b20e453c50858c6 (patch)
treea89e593a9a300133505fa15cc61a28690d66b7cc /src/runtime/iface.go
parentaabdb66d8909f772270b80eff3405cfd4cce4d8b (diff)
downloadgo-8b07ec20f7a971edce9eaf413b20e453c50858c6.tar.gz
go-8b07ec20f7a971edce9eaf413b20e453c50858c6.zip
cmd/compile, runtime: make the go.itab.* symbols module-local
Otherwise, the way the ELF dynamic linker works means that you can end up with the same itab being passed to additab twice, leading to the itab linked list having a cycle in it. Add a test to additab in runtime to catch this when it happens, not some arbitrary and surprsing time later. Fixes #17594 Change-Id: I6c82edcc9ac88ac188d1185370242dc92f46b1ad Reviewed-on: https://go-review.googlesource.com/32131 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/iface.go')
-rw-r--r--src/runtime/iface.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/runtime/iface.go b/src/runtime/iface.go
index b55a9ed893..f7ad40d1c0 100644
--- a/src/runtime/iface.go
+++ b/src/runtime/iface.go
@@ -138,6 +138,10 @@ func additab(m *itab, locked, canfail bool) {
throw("invalid itab locking")
}
h := itabhash(inter, typ)
+ if m == hash[h] {
+ println("duplicate itab for", typ.string(), "and", inter.typ.string())
+ throw("duplicate itabs")
+ }
m.link = hash[h]
atomicstorep(unsafe.Pointer(&hash[h]), unsafe.Pointer(m))
}