mirror of
https://github.com/golang/go.git
synced 2026-02-07 02:09:55 +00:00
cmd/link: put type:* at the start of the type descriptors
That used to happen naturally because the symbol had zero size. After CL 724261 we need to force it. Fixes #77372 Change-Id: Ia8eef989bc9cbad5459b60ff6535136e7e0c6cab Reviewed-on: https://go-review.googlesource.com/c/go/+/740400 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
14a4cb13e3
commit
c08f6a5b26
1 changed files with 12 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue