From 79688ca58f59a65eee324694fd8a559dae8af149 Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Thu, 17 Mar 2016 07:00:33 -0700 Subject: cmd/link: collect itablinks as a slice in moduledata See #14874 This change tells the linker to collect all the itablink symbols and collect them so that moduledata can have a slice of all compiler generated itabs. The logic is shamelessly adapted from what is done with typelink symbols. Change-Id: Ie93b59acf0fcba908a876d506afbf796f222dbac Reviewed-on: https://go-review.googlesource.com/20889 Reviewed-by: Keith Randall --- src/cmd/link/internal/ld/deadcode.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/cmd/link/internal/ld/deadcode.go') diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go index f99f5e8984..e1badc2a48 100644 --- a/src/cmd/link/internal/ld/deadcode.go +++ b/src/cmd/link/internal/ld/deadcode.go @@ -107,10 +107,11 @@ func deadcode(ctxt *Link) { } if Buildmode != BuildmodeShared { - // Keep a typelink if the symbol it points at is being kept. - // (When BuildmodeShared, always keep typelinks.) + // Keep a typelink or itablink if the symbol it points at is being kept. + // (When BuildmodeShared, always keep typelinks and itablinks.) for _, s := range ctxt.Allsym { - if strings.HasPrefix(s.Name, "go.typelink.") { + if strings.HasPrefix(s.Name, "go.typelink.") || + strings.HasPrefix(s.Name, "go.itablink.") { s.Attr.Set(AttrReachable, len(s.R) == 1 && s.R[0].Sym.Attr.Reachable()) } } -- cgit v1.3-5-g9baa