1
0
mirror of https://github.com/golang/go synced 2024-10-04 02:21:21 -06:00

cmd/ld: fix linux/386 build

TBR=iant
CC=golang-dev
https://golang.org/cl/39400044
This commit is contained in:
Russ Cox 2013-12-09 07:42:55 -08:00
parent 79479ac486
commit 0c0589ec42
3 changed files with 6 additions and 2 deletions

View File

@ -246,7 +246,7 @@ relocsym(LSym *s)
o = r->sym->size + r->add; o = r->sym->size + r->add;
break; break;
} }
//print("relocate %s %p %s => %p %p %p %p [%p]\n", s->name, s->value+off, r->sym ? r->sym->name : "<nil>", (void*)symaddr(r->sym), (void*)s->value, (void*)r->off, (void*)r->siz, (void*)o); //print("relocate %s %#llux (%#llux+%#llux, size %d) => %s %#llux +%#llx [%llx]\n", s->name, (uvlong)(s->value+off), (uvlong)s->value, (uvlong)r->off, r->siz, r->sym ? r->sym->name : "<nil>", (uvlong)symaddr(r->sym), (vlong)r->add, (vlong)o);
switch(siz) { switch(siz) {
default: default:
ctxt->cursym = s; ctxt->cursym = s;

View File

@ -712,6 +712,9 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn)
else else
diag("invalid rela size %d", rp->siz); diag("invalid rela size %d", rp->siz);
} }
if(rp->siz == 4)
rp->add = (int32)rp->add;
//print("rel %s %d %d %s %#llx\n", sect->sym->name, rp->type, rp->siz, rp->sym->name, rp->add);
} }
qsort(r, n, sizeof r[0], rbyoff); // just in case qsort(r, n, sizeof r[0], rbyoff); // just in case

View File

@ -79,7 +79,8 @@ linkpatch(Link *ctxt, LSym *sym)
ctxt->arch->progedit(ctxt, p); ctxt->arch->progedit(ctxt, p);
if(p->as == ctxt->arch->ACALL || (p->as == ctxt->arch->AJMP && p->to.type != ctxt->arch->D_BRANCH) || (p->as == ctxt->arch->ARET && p->to.sym != nil)) { if(p->as == ctxt->arch->ACALL || (p->as == ctxt->arch->AJMP && p->to.type != ctxt->arch->D_BRANCH) || (p->as == ctxt->arch->ARET && p->to.sym != nil)) {
s = p->to.sym; s = p->to.sym;
if(s) { // The STEXT check avoids rewriting indirect call to addr in memory on x86.
if(s && s->type == STEXT) {
p->to.type = ctxt->arch->D_BRANCH; p->to.type = ctxt->arch->D_BRANCH;
continue; continue;
} }