cmd/link: remove reading/processing of function Autom records

Remove linker reading and processing of automs (no longer needed, now
that the compiler is emitting R_USETYPE relocations on functions). So
as to avoid changing the object file format, the object still contains
a count of automs, but this count is required to be zero.

Updates #34554.

Change-Id: I10230e191057c5c5705541eeb06f747d5f73c42d
Reviewed-on: https://go-review.googlesource.com/c/go/+/197500
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Than McIntosh 2019-09-26 10:01:42 -04:00
parent cdd59205c4
commit 70a1efbb5c
4 changed files with 3 additions and 67 deletions

View file

@ -2366,7 +2366,6 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
}
}
var off int32
for _, s := range ctxt.Textp {
put(ctxt, s, s.Name, TextSym, s.Value, s.Gotype)
@ -2380,39 +2379,6 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
if s.FuncInfo == nil {
continue
}
for _, a := range s.FuncInfo.Autom {
if a.Name == objabi.A_DELETED_AUTO {
put(ctxt, nil, "", DeletedAutoSym, 0, a.Gotype)
continue
}
// Emit a or p according to actual offset, even if label is wrong.
// This avoids negative offsets, which cannot be encoded.
if a.Name != objabi.A_AUTO && a.Name != objabi.A_PARAM {
continue
}
// compute offset relative to FP
if a.Name == objabi.A_PARAM {
off = a.Aoffset
} else {
off = a.Aoffset - int32(ctxt.Arch.PtrSize)
}
// FP
if off >= 0 {
put(ctxt, nil, a.Asym.Name, ParamSym, int64(off), a.Gotype)
continue
}
// SP
if off <= int32(-ctxt.Arch.PtrSize) {
put(ctxt, nil, a.Asym.Name, AutoSym, -(int64(off) + int64(ctxt.Arch.PtrSize)), a.Gotype)
continue
}
// Otherwise, off is addressing the saved program counter.
// Something underhanded is going on. Say nothing.
}
}
if ctxt.Debugvlog != 0 || *flagN {