}
}
- var automDecls []*Node
- // Populate Automs for fn.
+ var apdecls []*Node
+ // Populate decls for fn.
for _, n := range fn.Func.Dcl {
if n.Op != ONAME { // might be OTYPE or OLITERAL
continue
}
- var name obj.AddrName
switch n.Class() {
case PAUTO:
if !n.Name.Used() {
}
continue
}
- name = obj.NAME_AUTO
case PPARAM, PPARAMOUT:
- name = obj.NAME_PARAM
default:
continue
}
- automDecls = append(automDecls, n)
- gotype := ngotype(n).Linksym()
- fnsym.Func.Autom = append(fnsym.Func.Autom, &obj.Auto{
- Asym: Ctxt.Lookup(n.Sym.Name),
- Aoffset: int32(n.Xoffset),
- Name: name,
- Gotype: gotype,
- })
- fnsym.Func.RecordAutoType(gotype)
+ apdecls = append(apdecls, n)
+ fnsym.Func.RecordAutoType(ngotype(n).Linksym())
}
- decls, dwarfVars := createDwarfVars(fnsym, fn.Func, automDecls)
+ decls, dwarfVars := createDwarfVars(fnsym, fn.Func, apdecls)
// For each type referenced by the functions auto vars, attach a
// dummy relocation to the function symbol to insure that the type
// createSimpleVars creates a DWARF entry for every variable declared in the
// function, claiming that they are permanently on the stack.
-func createSimpleVars(automDecls []*Node) ([]*Node, []*dwarf.Var, map[*Node]bool) {
+func createSimpleVars(apDecls []*Node) ([]*Node, []*dwarf.Var, map[*Node]bool) {
var vars []*dwarf.Var
var decls []*Node
selected := make(map[*Node]bool)
- for _, n := range automDecls {
+ for _, n := range apDecls {
if n.IsAutoTmp() {
continue
}
// createDwarfVars process fn, returning a list of DWARF variables and the
// Nodes they represent.
-func createDwarfVars(fnsym *obj.LSym, fn *Func, automDecls []*Node) ([]*Node, []*dwarf.Var) {
+func createDwarfVars(fnsym *obj.LSym, fn *Func, apDecls []*Node) ([]*Node, []*dwarf.Var) {
// Collect a raw list of DWARF vars.
var vars []*dwarf.Var
var decls []*Node
if Ctxt.Flag_locationlists && Ctxt.Flag_optimize && fn.DebugInfo != nil {
decls, vars, selected = createComplexVars(fn)
} else {
- decls, vars, selected = createSimpleVars(automDecls)
+ decls, vars, selected = createSimpleVars(apDecls)
}
- dcl := automDecls
+ dcl := apDecls
if fnsym.WasInlined() {
dcl = preInliningDcls(fnsym)
}
InlIndex: int32(inlIndex),
ChildIndex: -1,
})
- // Append a "deleted auto" entry to the autom list so as to
- // insure that the type in question is picked up by the linker.
- // See issue 22941.
- gotype := ngotype(n).Linksym()
- fnsym.Func.Autom = append(fnsym.Func.Autom, &obj.Auto{
- Asym: Ctxt.Lookup(n.Sym.Name),
- Aoffset: int32(-1),
- Name: obj.NAME_DELETED_AUTO,
- Gotype: gotype,
- })
- fnsym.Func.RecordAutoType(gotype)
+ // Record go type of to insure that it gets emitted by the linker.
+ fnsym.Func.RecordAutoType(ngotype(n).Linksym())
}
return decls, vars
nData int
nReloc int
nPcdata int
- nAutom int
nFuncdata int
nFile int
w.nData += data
w.nPcdata += len(pc.Pcdata)
- w.nAutom += len(s.Func.Autom)
w.nFuncdata += len(pc.Funcdataoff)
w.nFile += len(pc.File)
}
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))
}
}
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)
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)))