binmunge: allow relocations for function vector register loads
authorAlan Cox <alan@linux.intel.com>
Wed, 21 Nov 2018 00:32:21 +0000 (00:32 +0000)
committerAlan Cox <alan@linux.intel.com>
Wed, 21 Nov 2018 00:32:21 +0000 (00:32 +0000)
sdcc can generate this kind of code, so we need to generate stubs for
16bit register load fixups in code space

cp #1
jr z, 1f
ld hl,#func
jr 2f
1f: ld hl,#func2
2f:
push de
push bc
jp callhl
pop bc
pop de

Kernel/tools/binmunge.c

index b7f9ebe..c52aa86 100644 (file)
@@ -153,6 +153,9 @@ void code_reloc(uint8_t sbank, uint16_t ptr, uint8_t dbank)
   }
 
   switch(buf[sbank][ptr-1]) {
+    case 0x01: /* LD BC, */
+    case 0x11: /* LD DE, */
+    case 0x21: /* LD HL/IX/IY, */
     case 0xC3: /* JP - needs stub */
       if (v)
         printf("Converting JP at %04x to stub\n", ptr);