Divide/Modulo by 65536 not 16
authorRobert Pengelly <robertapengelly@hotmail.com>
Fri, 25 Apr 2025 06:43:32 +0000 (07:43 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Fri, 25 Apr 2025 06:43:32 +0000 (07:43 +0100)
link.c

diff --git a/link.c b/link.c
index ca350205a54dbd31f90bb6317af8bab6d239ca47..7958454b650bf3a938d5aeb4b87f671da54e7cfd 100644 (file)
--- a/link.c
+++ b/link.c
@@ -457,7 +457,8 @@ static void reloc_generic (struct section_part *part, struct reloc_entry *rel, s
                     result = (((unsigned long) dgroup_start / 16) << 16) | (unsigned long) temp;
                 
                 } else {
-                    result = (((unsigned long) result / 16) << 16) | (unsigned long) result % 16;
+                    /*result = (((unsigned long) result / 16) << 16) | (unsigned long) result % 16;*/
+                    result = (((unsigned long) result / 65536) << 16) | (unsigned long) result % 65536;
                 }
                 
                 /*printf ("relocating: %s: %lx, %lx, %lx\n", rel->symbol->name, part->rva + offset + 0x60, result, size);*/