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
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);
}
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: