aboutsummaryrefslogtreecommitdiff
path: root/src/liblink/objfile.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-04-16 17:11:44 -0400
committerRuss Cox <rsc@golang.org>2014-04-16 17:11:44 -0400
commitcc08d9232c4875a11b9e2a8097e069467d79f31f (patch)
tree03a531b03b0221d27193628b1990e2b7baa6f087 /src/liblink/objfile.c
parent0de521d111b88b2bc6466a4e1f29a8a284c0b3ee (diff)
downloadgo-cc08d9232c4875a11b9e2a8097e069467d79f31f.tar.xz
liblink: add leaf bit to object file format
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
Diffstat (limited to 'src/liblink/objfile.c')
-rw-r--r--src/liblink/objfile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/liblink/objfile.c b/src/liblink/objfile.c
index b52b29ca59..0c51e795f5 100644
--- a/src/liblink/objfile.c
+++ b/src/liblink/objfile.c
@@ -49,6 +49,7 @@
//
// - args [int]
// - locals [int]
+// - leaf [int]
// - nlocal [int]
// - local [nlocal automatics]
// - pcln [pcln table]
@@ -291,8 +292,11 @@ writesym(Link *ctxt, Biobuf *b, LSym *s)
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);
@@ -346,6 +350,7 @@ writesym(Link *ctxt, Biobuf *b, LSym *s)
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++;
@@ -566,6 +571,7 @@ readsym(Link *ctxt, Biobuf *f, char *pkg, char *pn)
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);