]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.link] cmd/link: fix aux symbol handling in Funcdata
authorCherry Zhang <cherryyz@google.com>
Fri, 10 Apr 2020 18:12:44 +0000 (14:12 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 10 Apr 2020 19:04:34 +0000 (19:04 +0000)
If a Go symbol is cloned to external, we should preserve its Aux
symbols for FuncInfo, etc.. We already do this in
loader.FuncInfo, but not in FuncInfo.Funcdata. Do it in the
latter as well. In fact, since FuncInfo and Funcdata should use
the same set of auxs, just record the auxs and reuse.

Should fix PPC64 build.

Change-Id: Iab9020eaca15d98fe3bb41f50f0d5bdb4999e8c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/227848
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/pcln.go
src/cmd/link/internal/loader/loader.go

index d6bba56eeeed601ffa21c72862748cf84c9dd1aa..c89ca602e7cdb099fa0ec150dedee0e6b8addd1c 100644 (file)
@@ -378,7 +378,7 @@ func (ctxt *Link) pclntab() {
                        for i := uint32(0); i < nfd; i++ {
                                funcdataoff = append(funcdataoff, fi.Funcdataoff(int(i)))
                        }
-                       funcdata = fi.Funcdata(s, funcdata)
+                       funcdata = fi.Funcdata(funcdata)
                }
 
                if fi.Valid() && fi.NumInlTree() > 0 {
index b9ef4c1d1a598bd16550486dbb7d5bfd5b86cc4f..7b82e532b9a91f3b984a8188c1e56c05762558a3 100644 (file)
@@ -1532,6 +1532,7 @@ type FuncInfo struct {
        l       *Loader
        r       *oReader
        data    []byte
+       auxs    []goobj2.Aux
        lengths goobj2.FuncInfoLengths
 }
 
@@ -1603,7 +1604,7 @@ func (fi *FuncInfo) Funcdataoff(k int) int64 {
        return (*goobj2.FuncInfo)(nil).ReadFuncdataoff(fi.data, fi.lengths.FuncdataoffOff, uint32(k))
 }
 
-func (fi *FuncInfo) Funcdata(fnsym Sym, syms []Sym) []Sym {
+func (fi *FuncInfo) Funcdata(syms []Sym) []Sym {
        if !fi.lengths.Initialized {
                panic("need to call Preload first")
        }
@@ -1612,10 +1613,8 @@ func (fi *FuncInfo) Funcdata(fnsym Sym, syms []Sym) []Sym {
        } else {
                syms = syms[:0]
        }
-       r, li := fi.l.toLocal(fnsym)
-       auxs := r.Auxs(li)
-       for j := range auxs {
-               a := &auxs[j]
+       for j := range fi.auxs {
+               a := &fi.auxs[j]
                if a.Type() == goobj2.AuxFuncdata {
                        syms = append(syms, fi.l.resolve(fi.r, a.Sym()))
                }
@@ -1686,7 +1685,7 @@ func (l *Loader) FuncInfo(i Sym) FuncInfo {
                a := &auxs[j]
                if a.Type() == goobj2.AuxFuncInfo {
                        b := r.Data(int(a.Sym().SymIdx))
-                       return FuncInfo{l, r, b, goobj2.FuncInfoLengths{}}
+                       return FuncInfo{l, r, b, auxs, goobj2.FuncInfoLengths{}}
                }
        }
        return FuncInfo{}