Commit 70a1efbb authored by Than McIntosh's avatar Than McIntosh

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/+/197500Reviewed-by: default avatarJeremy Faller <jeremy@golang.org>
parent cdd59205
...@@ -270,12 +270,6 @@ func (d *deadcodepass) flood() { ...@@ -270,12 +270,6 @@ func (d *deadcodepass) flood() {
if d.ctxt.Debugvlog > 1 { if d.ctxt.Debugvlog > 1 {
d.ctxt.Logf("marktext %s\n", s.Name) d.ctxt.Logf("marktext %s\n", s.Name)
} }
if s.FuncInfo != nil {
for _, a := range s.FuncInfo.Autom {
d.mark(a.Gotype, s)
}
}
} }
if strings.HasPrefix(s.Name, "type.") && s.Name[5] != '.' { if strings.HasPrefix(s.Name, "type.") && s.Name[5] != '.' {
......
...@@ -2366,7 +2366,6 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6 ...@@ -2366,7 +2366,6 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
} }
} }
var off int32
for _, s := range ctxt.Textp { for _, s := range ctxt.Textp {
put(ctxt, s, s.Name, TextSym, s.Value, s.Gotype) 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 ...@@ -2380,39 +2379,6 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
if s.FuncInfo == nil { if s.FuncInfo == nil {
continue 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 { if ctxt.Debugvlog != 0 || *flagN {
......
...@@ -55,7 +55,6 @@ type objReader struct { ...@@ -55,7 +55,6 @@ type objReader struct {
data []byte data []byte
reloc []sym.Reloc reloc []sym.Reloc
pcdata []sym.Pcdata pcdata []sym.Pcdata
autom []sym.Auto
funcdata []*sym.Symbol funcdata []*sym.Symbol
funcdataoff []int64 funcdataoff []int64
file []*sym.Symbol file []*sym.Symbol
...@@ -193,8 +192,7 @@ func (r *objReader) readSlices() { ...@@ -193,8 +192,7 @@ func (r *objReader) readSlices() {
r.reloc = make([]sym.Reloc, n) r.reloc = make([]sym.Reloc, n)
n = r.readInt() n = r.readInt()
r.pcdata = make([]sym.Pcdata, n) r.pcdata = make([]sym.Pcdata, n)
n = r.readInt() _ = r.readInt() // TODO: remove on next object file rev (autom count)
r.autom = make([]sym.Auto, n)
n = r.readInt() n = r.readInt()
r.funcdata = make([]*sym.Symbol, n) r.funcdata = make([]*sym.Symbol, n)
r.funcdataoff = make([]int64, n) r.funcdataoff = make([]int64, n)
...@@ -328,24 +326,10 @@ overwrite: ...@@ -328,24 +326,10 @@ overwrite:
s.Attr |= sym.AttrTopFrame s.Attr |= sym.AttrTopFrame
} }
n := r.readInt() n := r.readInt()
pc.Autom = r.autom[:n:n] if n != 0 {
if !isdup { log.Fatalf("stale object file: autom count nonzero")
r.autom = r.autom[n:]
} }
for i := 0; i < n; i++ {
pc.Autom[i] = sym.Auto{
Asym: r.readSymIndex(),
Aoffset: r.readInt32(),
Name: r.readInt16(),
Gotype: r.readSymIndex(),
}
}
// Temporary: zero out the autom list after we've read it.
// In a subsequent patch we'll remove autom handling more completely.
pc.Autom = nil
pc.Pcsp.P = r.readData() pc.Pcsp.P = r.readData()
pc.Pcfile.P = r.readData() pc.Pcfile.P = r.readData()
pc.Pcline.P = r.readData() pc.Pcline.P = r.readData()
......
...@@ -518,7 +518,6 @@ func SortSub(l *Symbol) *Symbol { ...@@ -518,7 +518,6 @@ func SortSub(l *Symbol) *Symbol {
type FuncInfo struct { type FuncInfo struct {
Args int32 Args int32
Locals int32 Locals int32
Autom []Auto
Pcsp Pcdata Pcsp Pcdata
Pcfile Pcdata Pcfile Pcdata
Pcline Pcdata Pcline Pcdata
...@@ -542,10 +541,3 @@ type InlinedCall struct { ...@@ -542,10 +541,3 @@ type InlinedCall struct {
type Pcdata struct { type Pcdata struct {
P []byte P []byte
} }
type Auto struct {
Asym *Symbol
Gotype *Symbol
Aoffset int32
Name int16
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment