Commit 40ff071e authored by Eoghan Sherry's avatar Eoghan Sherry Committed by Russ Cox

5g/8g, 8l, ld, prof: fix output of 32-bit values

If an %lld argument can be 32 or 64 bits wide, cast to vlong.
If always 32 bits, drop the ll.
Fixes #1336.

R=brainman, rsc
CC=golang-dev
https://golang.org/cl/3580041
parent 73fd2989
...@@ -1079,7 +1079,7 @@ checkoffset(Addr *a, int canemitcode) ...@@ -1079,7 +1079,7 @@ checkoffset(Addr *a, int canemitcode)
if(a->offset < unmappedzero) if(a->offset < unmappedzero)
return; return;
if(!canemitcode) if(!canemitcode)
fatal("checkoffset %#llx, cannot emit code", a->offset); fatal("checkoffset %#x, cannot emit code", a->offset);
// cannot rely on unmapped nil page at 0 to catch // cannot rely on unmapped nil page at 0 to catch
// reference with large offset. instead, emit explicit // reference with large offset. instead, emit explicit
......
...@@ -1659,7 +1659,7 @@ checkoffset(Addr *a, int canemitcode) ...@@ -1659,7 +1659,7 @@ checkoffset(Addr *a, int canemitcode)
if(a->offset < unmappedzero) if(a->offset < unmappedzero)
return; return;
if(!canemitcode) if(!canemitcode)
fatal("checkoffset %#llx, cannot emit code", a->offset); fatal("checkoffset %#x, cannot emit code", a->offset);
// cannot rely on unmapped nil page at 0 to catch // cannot rely on unmapped nil page at 0 to catch
// reference with large offset. instead, emit explicit // reference with large offset. instead, emit explicit
......
...@@ -110,7 +110,7 @@ span1(Sym *s) ...@@ -110,7 +110,7 @@ span1(Sym *s)
s->size = c; s->size = c;
if(debug['a'] > 1) { if(debug['a'] > 1) {
print("span1 %s %lld (%d tries)\n %.6ux", s->name, s->size, n, 0); print("span1 %s %d (%d tries)\n %.6ux", s->name, s->size, n, 0);
for(i=0; i<s->np; i++) { for(i=0; i<s->np; i++) {
print(" %.2ux", s->p[i]); print(" %.2ux", s->p[i]);
if(i%16 == 15) if(i%16 == 15)
...@@ -123,7 +123,7 @@ span1(Sym *s) ...@@ -123,7 +123,7 @@ span1(Sym *s)
Reloc *r; Reloc *r;
r = &s->r[i]; r = &s->r[i];
print(" rel %#.4ux/%d %s%+lld\n", r->off, r->siz, r->sym->name, r->add); print(" rel %#.4ux/%d %s%+d\n", r->off, r->siz, r->sym->name, r->add);
} }
} }
} }
......
...@@ -399,7 +399,7 @@ blk(Sym *allsym, int32 addr, int32 size) ...@@ -399,7 +399,7 @@ blk(Sym *allsym, int32 addr, int32 size)
for(; addr < sym->value+sym->size; addr++) for(; addr < sym->value+sym->size; addr++)
cput(0); cput(0);
if(addr != sym->value+sym->size) { if(addr != sym->value+sym->size) {
diag("phase error: addr=%#llx value+size=%#llx", addr, sym->value+sym->size); diag("phase error: addr=%#llx value+size=%#llx", (vlong)addr, (vlong)sym->value+sym->size);
errorexit(); errorexit();
} }
} }
...@@ -464,7 +464,7 @@ codeblk(int32 addr, int32 size) ...@@ -464,7 +464,7 @@ codeblk(int32 addr, int32 size)
continue; continue;
} }
Bprint(&bso, "%.6llux\t%-20s | %P\n", sym->value, sym->name, p); Bprint(&bso, "%.6llux\t%-20s | %P\n", (vlong)sym->value, sym->name, p);
for(p = p->link; p != P; p = p->link) { for(p = p->link; p != P; p = p->link) {
if(p->link != P) if(p->link != P)
epc = p->link->pc; epc = p->link->pc;
...@@ -725,7 +725,7 @@ dodata(void) ...@@ -725,7 +725,7 @@ dodata(void)
s->type = SDATA; s->type = SDATA;
if(s->np > s->size) if(s->np > s->size)
diag("%s: initialize bounds (%lld < %d)", diag("%s: initialize bounds (%lld < %d)",
s->name, s->size, s->np); s->name, (vlong)s->size, s->np);
} }
/* /*
......
...@@ -1004,7 +1004,7 @@ defgotype(Sym *gotype) ...@@ -1004,7 +1004,7 @@ defgotype(Sym *gotype)
gotype->r[i].siz, gotype->r[i].siz,
gotype->r[i].type, gotype->r[i].type,
gotype->r[i].sym->name, gotype->r[i].sym->name,
gotype->r[i].add); (vlong)gotype->r[i].add);
} }
} }
...@@ -1927,7 +1927,7 @@ writelines(void) ...@@ -1927,7 +1927,7 @@ writelines(void)
lline = lh->line + q->line - lh->absline; lline = lh->line + q->line - lh->absline;
if (debug['v'] > 1) if (debug['v'] > 1)
print("%6llux %s[%lld] %P\n", q->pc, histfile[lh->file], lline, q); print("%6llux %s[%lld] %P\n", (vlong)q->pc, histfile[lh->file], lline, q);
if (q->line == lc) if (q->line == lc)
continue; continue;
......
...@@ -915,7 +915,7 @@ pclntab(void) ...@@ -915,7 +915,7 @@ pclntab(void)
if(p->line == oldlc || p->as == ATEXT || p->as == ANOP) { if(p->line == oldlc || p->as == ATEXT || p->as == ANOP) {
if(debug['O']) if(debug['O'])
Bprint(&bso, "%6llux %P\n", Bprint(&bso, "%6llux %P\n",
p->pc, p); (vlong)p->pc, p);
continue; continue;
} }
if(debug['O']) if(debug['O'])
...@@ -952,7 +952,7 @@ pclntab(void) ...@@ -952,7 +952,7 @@ pclntab(void)
Bprint(&bso, " lc%d(%d,%d)\n", Bprint(&bso, " lc%d(%d,%d)\n",
s, 0, s); s, 0, s);
Bprint(&bso, "%6llux %P\n", Bprint(&bso, "%6llux %P\n",
p->pc, p); (vlong)p->pc, p);
} }
lcsize += 5; lcsize += 5;
continue; continue;
...@@ -964,14 +964,14 @@ pclntab(void) ...@@ -964,14 +964,14 @@ pclntab(void)
if(debug['O']) { if(debug['O']) {
Bprint(&bso, " lc+%d(%d)\n", s, 0+s); Bprint(&bso, " lc+%d(%d)\n", s, 0+s);
Bprint(&bso, "%6llux %P\n", Bprint(&bso, "%6llux %P\n",
p->pc, p); (vlong)p->pc, p);
} }
} else { } else {
*bp = 64-s; /* 65-128 -lc */ *bp = 64-s; /* 65-128 -lc */
if(debug['O']) { if(debug['O']) {
Bprint(&bso, " lc%d(%d)\n", s, 64-s); Bprint(&bso, " lc%d(%d)\n", s, 64-s);
Bprint(&bso, "%6llux %P\n", Bprint(&bso, "%6llux %P\n",
p->pc, p); (vlong)p->pc, p);
} }
} }
lcsize++; lcsize++;
......
...@@ -193,22 +193,22 @@ amd64_ppword(uvlong w) ...@@ -193,22 +193,22 @@ amd64_ppword(uvlong w)
void void
x86_regprint(void) x86_regprint(void)
{ {
fprint(2, "ax\t0x%llux\n", ureg_x86.ax); fprint(2, "ax\t0x%ux\n", ureg_x86.ax);
fprint(2, "bx\t0x%llux\n", ureg_x86.bx); fprint(2, "bx\t0x%ux\n", ureg_x86.bx);
fprint(2, "cx\t0x%llux\n", ureg_x86.cx); fprint(2, "cx\t0x%ux\n", ureg_x86.cx);
fprint(2, "dx\t0x%llux\n", ureg_x86.dx); fprint(2, "dx\t0x%ux\n", ureg_x86.dx);
fprint(2, "si\t0x%llux\n", ureg_x86.si); fprint(2, "si\t0x%ux\n", ureg_x86.si);
fprint(2, "di\t0x%llux\n", ureg_x86.di); fprint(2, "di\t0x%ux\n", ureg_x86.di);
fprint(2, "bp\t0x%llux\n", ureg_x86.bp); fprint(2, "bp\t0x%ux\n", ureg_x86.bp);
fprint(2, "ds\t0x%llux\n", ureg_x86.ds); fprint(2, "ds\t0x%ux\n", ureg_x86.ds);
fprint(2, "es\t0x%llux\n", ureg_x86.es); fprint(2, "es\t0x%ux\n", ureg_x86.es);
fprint(2, "fs\t0x%llux\n", ureg_x86.fs); fprint(2, "fs\t0x%ux\n", ureg_x86.fs);
fprint(2, "gs\t0x%llux\n", ureg_x86.gs); fprint(2, "gs\t0x%ux\n", ureg_x86.gs);
fprint(2, "cs\t0x%llux\n", ureg_x86.cs); fprint(2, "cs\t0x%ux\n", ureg_x86.cs);
fprint(2, "flags\t0x%llux\n", ureg_x86.flags); fprint(2, "flags\t0x%ux\n", ureg_x86.flags);
fprint(2, "pc\t0x%llux\n", ureg_x86.pc); fprint(2, "pc\t0x%ux\n", ureg_x86.pc);
fprint(2, "sp\t0x%llux\n", ureg_x86.sp); fprint(2, "sp\t0x%ux\n", ureg_x86.sp);
fprint(2, "ss\t0x%llux\n", ureg_x86.ss); fprint(2, "ss\t0x%ux\n", ureg_x86.ss);
} }
int int
......
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