mirror of
https://github.com/golang/go
synced 2024-11-26 02:17:58 -07:00
cmd/ld: fix check for address wrap in relocation
PC-relative needs a signed offset; others need unsigned. Also fix signedness of 32-bit relocation on Windows. R=golang-dev, iant CC=golang-dev https://golang.org/cl/9039045
This commit is contained in:
parent
e2b2e0d8d1
commit
700a126c64
@ -259,8 +259,7 @@ relocsym(Sym *s)
|
||||
cursym = s;
|
||||
diag("bad reloc size %#ux for %s", siz, r->sym->name);
|
||||
case 4:
|
||||
// TODO: Test is causing breakages on ARM and Windows. Disable for now.
|
||||
if(0 && o != (int32)o) {
|
||||
if((r->type == D_PCREL && o != (int32)o) || (r->type != D_PCREL && o != (uint32)o)) {
|
||||
cursym = S;
|
||||
diag("relocation address is too big: %#llx", o);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
|
||||
case IMAGE_REL_AMD64_ADDR32: // R_X86_64_PC32
|
||||
case IMAGE_REL_AMD64_ADDR32NB:
|
||||
rp->type = D_PCREL;
|
||||
rp->add = le32(rsect->base+rp->off);
|
||||
rp->add = (int32)le32(rsect->base+rp->off);
|
||||
break;
|
||||
case IMAGE_REL_I386_DIR32NB:
|
||||
case IMAGE_REL_I386_DIR32:
|
||||
|
Loading…
Reference in New Issue
Block a user