Commit 75c918c1 authored by Lucio De Re's avatar Lucio De Re Committed by Russ Cox

ld: fix build on Plan 9

ld/data.c:
. Format specifier with corresponding cast to cater for all
  architectures (llux and vlong).

ld/ldelf.c:
ld/ldmacho.c:
. Missing "pn" argument in diag() calls.

ld/ldpe.c:
. Dropped "sym->sectnum" in diag() call.
. Typo in a comment.

ld/lib.h:
. Added varargck pragma for "O".

R=rsc
CC=golang-dev
https://golang.org/cl/4749042
parent eb3f2083
...@@ -512,7 +512,7 @@ codeblk(int32 addr, int32 size) ...@@ -512,7 +512,7 @@ codeblk(int32 addr, int32 size)
epc = p->link->pc; epc = p->link->pc;
else else
epc = sym->value + sym->size; epc = sym->value + sym->size;
Bprint(&bso, "%.6ux\t", p->pc); Bprint(&bso, "%.6llux\t", (uvlong)p->pc);
q = sym->p + p->pc - sym->value; q = sym->p + p->pc - sym->value;
n = epc - p->pc; n = epc - p->pc;
Bprint(&bso, "%-20.*I | %P\n", (int)n, q, p); Bprint(&bso, "%-20.*I | %P\n", (int)n, q, p);
......
...@@ -398,13 +398,13 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn) ...@@ -398,13 +398,13 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
goto bad; goto bad;
if(e->e16(hdr->type) != ElfTypeRelocatable) { if(e->e16(hdr->type) != ElfTypeRelocatable) {
diag("%s: elf but not elf relocatable object"); diag("%s: elf but not elf relocatable object", pn);
return; return;
} }
switch(thechar) { switch(thechar) {
default: default:
diag("%s: elf %s unimplemented", thestring); diag("%s: elf %s unimplemented", pn, thestring);
return; return;
case '5': case '5':
if(e != &le || obj->machine != ElfMachArm || hdr->ident[4] != ElfClass32) { if(e != &le || obj->machine != ElfMachArm || hdr->ident[4] != ElfClass32) {
......
...@@ -480,7 +480,7 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn) ...@@ -480,7 +480,7 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
switch(thechar) { switch(thechar) {
default: default:
diag("%s: mach-o %s unimplemented", thestring); diag("%s: mach-o %s unimplemented", pn, thestring);
return; return;
case '6': case '6':
if(e != &le || m->cputype != MachoCpuAmd64) { if(e != &le || m->cputype != MachoCpuAmd64) {
......
...@@ -338,7 +338,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn) ...@@ -338,7 +338,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
if(sect->sym == 0) if(sect->sym == 0)
diag("%s: %s sym == 0!", pn, s->name); diag("%s: %s sym == 0!", pn, s->name);
} else { } else {
diag("%s: %s sectnum <0!", pn, s->name, sym->sectnum); diag("%s: %s sectnum < 0!", pn, s->name);
} }
if(sect == nil) if(sect == nil)
...@@ -383,7 +383,7 @@ map(PeObj *obj, PeSect *sect) ...@@ -383,7 +383,7 @@ map(PeObj *obj, PeSect *sect)
return 0; return 0;
sect->base = mal(sect->sh.SizeOfRawData); sect->base = mal(sect->sh.SizeOfRawData);
if(sect->sh.PointerToRawData == 0) // .bss don't has data in object file. if(sect->sh.PointerToRawData == 0) // .bss doesn't have data in object file
return 0; return 0;
werrstr("short read"); werrstr("short read");
if(Bseek(obj->f, obj->base+sect->sh.PointerToRawData, 0) < 0 || if(Bseek(obj->f, obj->base+sect->sh.PointerToRawData, 0) < 0 ||
......
...@@ -277,6 +277,8 @@ extern Header headers[]; ...@@ -277,6 +277,8 @@ extern Header headers[];
int headtype(char*); int headtype(char*);
int Yconv(Fmt*); int Yconv(Fmt*);
#pragma varargck type "O" int
#pragma varargck type "Y" Sym* #pragma varargck type "Y" Sym*
// buffered output // buffered output
......
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