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)
if(a->offset < unmappedzero)
return;
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
// reference with large offset. instead, emit explicit
......
......@@ -1659,7 +1659,7 @@ checkoffset(Addr *a, int canemitcode)
if(a->offset < unmappedzero)
return;
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
// reference with large offset. instead, emit explicit
......
......@@ -110,7 +110,7 @@ span1(Sym *s)
s->size = c;
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++) {
print(" %.2ux", s->p[i]);
if(i%16 == 15)
......@@ -123,7 +123,7 @@ span1(Sym *s)
Reloc *r;
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)
for(; addr < sym->value+sym->size; addr++)
cput(0);
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();
}
}
......@@ -464,7 +464,7 @@ codeblk(int32 addr, int32 size)
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) {
if(p->link != P)
epc = p->link->pc;
......@@ -725,7 +725,7 @@ dodata(void)
s->type = SDATA;
if(s->np > s->size)
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)
gotype->r[i].siz,
gotype->r[i].type,
gotype->r[i].sym->name,
gotype->r[i].add);
(vlong)gotype->r[i].add);
}
}
......@@ -1927,7 +1927,7 @@ writelines(void)
lline = lh->line + q->line - lh->absline;
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)
continue;
......
......@@ -915,7 +915,7 @@ pclntab(void)
if(p->line == oldlc || p->as == ATEXT || p->as == ANOP) {
if(debug['O'])
Bprint(&bso, "%6llux %P\n",
p->pc, p);
(vlong)p->pc, p);
continue;
}
if(debug['O'])
......@@ -952,7 +952,7 @@ pclntab(void)
Bprint(&bso, " lc%d(%d,%d)\n",
s, 0, s);
Bprint(&bso, "%6llux %P\n",
p->pc, p);
(vlong)p->pc, p);
}
lcsize += 5;
continue;
......@@ -964,14 +964,14 @@ pclntab(void)
if(debug['O']) {
Bprint(&bso, " lc+%d(%d)\n", s, 0+s);
Bprint(&bso, "%6llux %P\n",
p->pc, p);
(vlong)p->pc, p);
}
} else {
*bp = 64-s; /* 65-128 -lc */
if(debug['O']) {
Bprint(&bso, " lc%d(%d)\n", s, 64-s);
Bprint(&bso, "%6llux %P\n",
p->pc, p);
(vlong)p->pc, p);
}
}
lcsize++;
......
......@@ -193,22 +193,22 @@ amd64_ppword(uvlong w)
void
x86_regprint(void)
{
fprint(2, "ax\t0x%llux\n", ureg_x86.ax);
fprint(2, "bx\t0x%llux\n", ureg_x86.bx);
fprint(2, "cx\t0x%llux\n", ureg_x86.cx);
fprint(2, "dx\t0x%llux\n", ureg_x86.dx);
fprint(2, "si\t0x%llux\n", ureg_x86.si);
fprint(2, "di\t0x%llux\n", ureg_x86.di);
fprint(2, "bp\t0x%llux\n", ureg_x86.bp);
fprint(2, "ds\t0x%llux\n", ureg_x86.ds);
fprint(2, "es\t0x%llux\n", ureg_x86.es);
fprint(2, "fs\t0x%llux\n", ureg_x86.fs);
fprint(2, "gs\t0x%llux\n", ureg_x86.gs);
fprint(2, "cs\t0x%llux\n", ureg_x86.cs);
fprint(2, "flags\t0x%llux\n", ureg_x86.flags);
fprint(2, "pc\t0x%llux\n", ureg_x86.pc);
fprint(2, "sp\t0x%llux\n", ureg_x86.sp);
fprint(2, "ss\t0x%llux\n", ureg_x86.ss);
fprint(2, "ax\t0x%ux\n", ureg_x86.ax);
fprint(2, "bx\t0x%ux\n", ureg_x86.bx);
fprint(2, "cx\t0x%ux\n", ureg_x86.cx);
fprint(2, "dx\t0x%ux\n", ureg_x86.dx);
fprint(2, "si\t0x%ux\n", ureg_x86.si);
fprint(2, "di\t0x%ux\n", ureg_x86.di);
fprint(2, "bp\t0x%ux\n", ureg_x86.bp);
fprint(2, "ds\t0x%ux\n", ureg_x86.ds);
fprint(2, "es\t0x%ux\n", ureg_x86.es);
fprint(2, "fs\t0x%ux\n", ureg_x86.fs);
fprint(2, "gs\t0x%ux\n", ureg_x86.gs);
fprint(2, "cs\t0x%ux\n", ureg_x86.cs);
fprint(2, "flags\t0x%ux\n", ureg_x86.flags);
fprint(2, "pc\t0x%ux\n", ureg_x86.pc);
fprint(2, "sp\t0x%ux\n", ureg_x86.sp);
fprint(2, "ss\t0x%ux\n", ureg_x86.ss);
}
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