diff options
| -rw-r--r-- | src/cmd/link/internal/ld/data.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go index 63fe516d4e..683df3bb67 100644 --- a/src/cmd/link/internal/ld/data.go +++ b/src/cmd/link/internal/ld/data.go @@ -2395,6 +2395,9 @@ func (state *dodataState) dodataSect(ctxt *Link, symn sym.SymKind, syms []loader // sorted by type string. The reflect package will use // this to ensure that type descriptor pointers are unique. + // We define type:* for some links. + typeStar := ldr.Lookup("type:*", 0) + // Compute all the type strings we need once. typelinkStrings := make(map[loader.Sym]string) for _, s := range syms { @@ -2410,6 +2413,14 @@ func (state *dodataState) dodataSect(ctxt *Link, symn sym.SymKind, syms []loader if ret, matched := sortHeadTail(si, sj); matched { return ret } + if typeStar != 0 { + // type:* comes first, after runtime.types + if si == typeStar { + return true + } else if sj == typeStar { + return false + } + } iTypestr, iIsTypelink := typelinkStrings[si] jTypestr, jIsTypelink := typelinkStrings[sj] @@ -2438,7 +2449,7 @@ func (state *dodataState) dodataSect(ctxt *Link, symn sym.SymKind, syms []loader typeLinkSize := int64(1) for i := range sl { si := sl[i].sym - if si == head { + if si == head || si == typeStar { continue } if _, isTypelink := typelinkStrings[si]; !isTypelink { |
