mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: make module typemaps visible to the GC
The map[typeOff]*_type object is created at run time and stored in the moduledata. The moduledata object is marked by the linker as SNOPTRDATA, so the reference is ignored by the GC. Running misc/cgo/testplugin/test.bash with GOGC=1 will eventually collect the typemap and crash. This bug probably comes up in -linkshared binaries in Go 1.7. I don't know why we haven't seen a report about this yet. Fixes #17680 Change-Id: I0e9b5c006010e8edd51d9471651620ba665248d3 Reviewed-on: https://go-review.googlesource.com/32430 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
9da7058466
commit
f4c7a12c2c
2 changed files with 12 additions and 1 deletions
|
|
@ -497,7 +497,9 @@ func typelinksinit() {
|
|||
// If any of this module's typelinks match a type from a
|
||||
// prior module, prefer that prior type by adding the offset
|
||||
// to this module's typemap.
|
||||
md.typemap = make(map[typeOff]*_type, len(md.typelinks))
|
||||
tm := make(map[typeOff]*_type, len(md.typelinks))
|
||||
pinnedTypemaps = append(pinnedTypemaps, tm)
|
||||
md.typemap = tm
|
||||
for _, tl := range md.typelinks {
|
||||
t := (*_type)(unsafe.Pointer(md.types + uintptr(tl)))
|
||||
for _, candidate := range typehash[t.hash] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue