From 40ff071e9b7263f20115f7f84c750e537f58b8a0 Mon Sep 17 00:00:00 2001 From: Eoghan Sherry Date: Sun, 12 Dec 2010 14:40:19 -0500 Subject: [PATCH] 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 --- src/cmd/5g/gsubr.c | 2 +- src/cmd/8g/gsubr.c | 2 +- src/cmd/8l/span.c | 4 ++-- src/cmd/ld/data.c | 6 +++--- src/cmd/ld/dwarf.c | 4 ++-- src/cmd/ld/lib.c | 8 ++++---- src/cmd/prof/main.c | 32 ++++++++++++++++---------------- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/cmd/5g/gsubr.c b/src/cmd/5g/gsubr.c index f2a882bd6f..133a21b3e8 100644 --- a/src/cmd/5g/gsubr.c +++ b/src/cmd/5g/gsubr.c @@ -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 diff --git a/src/cmd/8g/gsubr.c b/src/cmd/8g/gsubr.c index b686add837..8ed7e55645 100644 --- a/src/cmd/8g/gsubr.c +++ b/src/cmd/8g/gsubr.c @@ -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 diff --git a/src/cmd/8l/span.c b/src/cmd/8l/span.c index b047908104..7d28fa279f 100644 --- a/src/cmd/8l/span.c +++ b/src/cmd/8l/span.c @@ -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; inp; 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); } } } diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c index c1e455c340..3ca7f0941c 100644 --- a/src/cmd/ld/data.c +++ b/src/cmd/ld/data.c @@ -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); } /* diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c index adffb890a7..7063078406 100644 --- a/src/cmd/ld/dwarf.c +++ b/src/cmd/ld/dwarf.c @@ -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; diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index 0aefb3e92b..ae77247c34 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -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++; diff --git a/src/cmd/prof/main.c b/src/cmd/prof/main.c index e57c161536..f36759cd32 100644 --- a/src/cmd/prof/main.c +++ b/src/cmd/prof/main.c @@ -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