Change-Id: I38e59088c37426d914ce2b4dfc79f3d476e06f49
Reviewed-on: https://go-review.googlesource.com/19617
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
func Linkprfile(ctxt *Link, line int) {
fmt.Printf("%s ", ctxt.LineHist.LineString(line))
}
+
+func fieldtrack(ctxt *Link, cursym *LSym) {
+ p := cursym.Text
+ if p == nil || p.Link == nil { // handle external functions and ELF section symbols
+ return
+ }
+ ctxt.Cursym = cursym
+
+ for ; p != nil; p = p.Link {
+ if p.As == AUSEFIELD {
+ r := Addrel(ctxt.Cursym)
+ r.Off = 0
+ r.Siz = 0
+ r.Sym = p.From.Sym
+ r.Type = R_USEFIELD
+ }
+ }
+}
ctxt.Arch.Follow(ctxt, s)
ctxt.Arch.Preprocess(ctxt, s)
ctxt.Arch.Assemble(ctxt, s)
+ fieldtrack(ctxt, s)
linkpcln(ctxt, s)
}
ctxt.Andptr = ctxt.And[:]
ctxt.Asmode = int(p.Mode)
- if p.As == obj.AUSEFIELD {
- r := obj.Addrel(ctxt.Cursym)
- r.Off = 0
- r.Siz = 0
- r.Sym = p.From.Sym
- r.Type = obj.R_USEFIELD
- return
- }
-
if ctxt.Headtype == obj.Hnacl && p.Mode == 32 {
switch p.As {
case obj.ARET: