From e35e503775bdb5a1731c50ad7f387e5c2982cfaa Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 4 Oct 2018 23:04:27 +0100 Subject: [PATCH] relocbin: fixes and update the relocation format a bit --- Library/tools/relocbin.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/tools/relocbin.c b/Library/tools/relocbin.c index 69701b26..76a8ba93 100644 --- a/Library/tools/relocbin.c +++ b/Library/tools/relocbin.c @@ -69,24 +69,24 @@ static void sweep_relocations(void) if (*base == *base2 - 1) { int diff = pos - lastrel; // printf("Relocation %d at %x\n", ++rels, pos); - /* 0 - 253 skip that many and reloc, 254 move on 254, 255 end */ - while(diff > 253) { + /* 1 - 254 skip that many and reloc, 255 move on 254, 0 end */ + while(diff > 254) { diff -= 254; - *relptr++ = 254; + *relptr++ = 255; } *relptr++ = diff; + lastrel = pos; pos++; (*base)--; base++; base2++; - lastrel = pos; continue; } fprintf(stderr, "Bad relocation at %d (%02X v %02X)\n", pos, *base, *base2); exit(1); } - *relptr++ = 0xFF; + *relptr++ = 0x00; relsize = relptr - (buf + s__DATA); /* In effect move the relocations from DATA into INITIALIZED */ s__DATA += relsize; -- 2.34.1