Without the leaf bit, the linker cannot record
the correct frame size in the symbol table, and
then stack traces get mangled. (Only for ARM.)
Fixes #7338.
Fixes #7347.
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/
88550043
{
int32 i, nfunc, start, funcstart;
LSym *ftab, *s;
- int32 off, end;
+ int32 off, end, frameptrsize;
int64 funcdata_bytes;
Pcln *pcln;
Pciter it;
// when a called function doesn't have argument information.
// We need to make sure everything has argument information
// and then remove this.
- off = setuint32(ctxt, ftab, off, ctxt->cursym->locals + PtrSize);
+ frameptrsize = PtrSize;
+ if(ctxt->cursym->leaf)
+ frameptrsize = 0;
+ off = setuint32(ctxt, ftab, off, ctxt->cursym->locals + frameptrsize);
if(pcln != &zpcln) {
renumberfiles(pcln->file, pcln->nfile, &pcln->pcfile);
//
// - args [int]
// - locals [int]
+// - leaf [int]
// - nlocal [int]
// - local [nlocal automatics]
// - pcln [pcln table]
if(s->dupok)
Bprint(ctxt->bso, "dupok ");
Bprint(ctxt->bso, "size=%lld value=%lld", (vlong)s->size, (vlong)s->value);
- if(s->type == STEXT)
+ if(s->type == STEXT) {
Bprint(ctxt->bso, " args=%#llux locals=%#llux", (uvlong)s->args, (uvlong)s->locals);
+ if(s->leaf)
+ Bprint(ctxt->bso, " leaf");
+ }
Bprint(ctxt->bso, "\n");
for(p=s->text; p != nil; p = p->link)
Bprint(ctxt->bso, "\t%#06ux %P\n", (int)p->pc, p);
if(s->type == STEXT) {
wrint(b, s->args);
wrint(b, s->locals);
+ wrint(b, s->leaf);
n = 0;
for(a = s->autom; a != nil; a = a->link)
n++;
if(s->type == STEXT) {
s->args = rdint(f);
s->locals = rdint(f);
+ s->leaf = rdint(f);
n = rdint(f);
for(i=0; i<n; i++) {
a = emallocz(sizeof *a);
type Func struct {
Args int // size in bytes of of argument frame: inputs and outputs
Frame int // size in bytes of local variable frame
+ Leaf bool // function omits save of link register (ARM)
Var []Var // detail about local variables
PCSP Data // PC → SP offset map
PCFile Data // PC → file number map (index into File)
s.Func = f
f.Args = r.readInt()
f.Frame = r.readInt()
+ f.Leaf = r.readInt() != 0
f.Var = make([]Var, r.readInt())
for i := range f.Var {
v := &f.Var[i]