cmd/compile: don't emit autom's into object file

Don't write Autom records when writing a function to the object file;
we no longer need them in the linker for DWARF processing. So as to
keep the object file format unchanged, write out a zero-length list of
automs to the object, as opposed to removing all references.

Updates #34554.

Change-Id: I42a1d67207ea7114ae4f3a315cf37effba57f190
Reviewed-on: https://go-review.googlesource.com/c/go/+/197499
Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
Than McIntosh 2019-09-26 09:53:37 -04:00
parent e72f002ed0
commit cdd59205c4
3 changed files with 14 additions and 57 deletions

View file

@ -31,7 +31,6 @@ type objWriter struct {
nData int
nReloc int
nPcdata int
nAutom int
nFuncdata int
nFile int
@ -60,7 +59,6 @@ func (w *objWriter) addLengths(s *LSym) {
w.nData += data
w.nPcdata += len(pc.Pcdata)
w.nAutom += len(s.Func.Autom)
w.nFuncdata += len(pc.Funcdataoff)
w.nFile += len(pc.File)
}
@ -69,7 +67,7 @@ func (w *objWriter) writeLengths() {
w.writeInt(int64(w.nData))
w.writeInt(int64(w.nReloc))
w.writeInt(int64(w.nPcdata))
w.writeInt(int64(w.nAutom))
w.writeInt(int64(0)) // TODO: remove at next object file rev
w.writeInt(int64(w.nFuncdata))
w.writeInt(int64(w.nFile))
}
@ -206,10 +204,6 @@ func (w *objWriter) writeRefs(s *LSym) {
}
if s.Type == objabi.STEXT {
for _, a := range s.Func.Autom {
w.writeRef(a.Asym, false)
w.writeRef(a.Gotype, false)
}
pc := &s.Func.Pcln
for _, d := range pc.Funcdata {
w.writeRef(d, false)
@ -364,21 +358,7 @@ func (w *objWriter) writeSym(s *LSym) {
flags |= 1 << 4
}
w.writeInt(flags)
w.writeInt(int64(len(s.Func.Autom)))
for _, a := range s.Func.Autom {
w.writeRefIndex(a.Asym)
w.writeInt(int64(a.Aoffset))
if a.Name == NAME_AUTO {
w.writeInt(objabi.A_AUTO)
} else if a.Name == NAME_PARAM {
w.writeInt(objabi.A_PARAM)
} else if a.Name == NAME_DELETED_AUTO {
w.writeInt(objabi.A_DELETED_AUTO)
} else {
log.Fatalf("%s: invalid local variable type %d", s.Name, a.Name)
}
w.writeRefIndex(a.Gotype)
}
w.writeInt(int64(0)) // TODO: remove at next object file rev
pc := &s.Func.Pcln
w.writeInt(int64(len(pc.Pcsp.P)))