This patch fixes the erroneous relocations that caused
the bug in ticket #4867. External addresses and global
offset table entries were relocated correctly, but all other
relocations were incorrectly calculated. This caused, for
example, bad references to constants stored in the __const
section of the __TEXT segment.
This bug only affected OS X on 64-bit platforms.
- value = sections[reloc->r_symbolnum-1].offset
- - sections[reloc->r_symbolnum-1].addr
- + (uint64_t) image;
+ value = relocateAddress(oc, nSections, sections, reloc->r_address);
}
IF_DEBUG(linker, debugBelch("relocateSection: value = %p\n", (void *)value));
}
IF_DEBUG(linker, debugBelch("relocateSection: value = %p\n", (void *)value));