diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp index 0384b322624..5d5ff3a2c41 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp @@ -287,6 +287,16 @@ void RuntimeDyldMachO::processRelocationRef(unsigned SectionID, macho::RelocationEntry RE = MachO->getRelocation(RelI.getRawDataRefImpl()); uint32_t RelType = MachO->getAnyRelocationType(RE); + + // FIXME: Properly handle scattered relocations. + // For now, optimistically skip these: they can often be ignored, as + // the static linker will already have applied the relocation, and it + // only needs to be reapplied if symbols move relative to one another. + // Note: This will fail horribly where the relocations *do* need to be + // applied, but that was already the case. + if (MachO->isRelocationScattered(RE)) + return; + RelocationValueRef Value; SectionEntry &Section = Sections[SectionID]; diff --git a/test/ExecutionEngine/RuntimeDyld/Inputs/arm_secdiff_reloc.o b/test/ExecutionEngine/RuntimeDyld/Inputs/arm_secdiff_reloc.o new file mode 100644 index 00000000000..5392266cf56 Binary files /dev/null and b/test/ExecutionEngine/RuntimeDyld/Inputs/arm_secdiff_reloc.o differ diff --git a/test/ExecutionEngine/RuntimeDyld/arm_secdiff_reloc.test b/test/ExecutionEngine/RuntimeDyld/arm_secdiff_reloc.test new file mode 100644 index 00000000000..92e4dd793cc --- /dev/null +++ b/test/ExecutionEngine/RuntimeDyld/arm_secdiff_reloc.test @@ -0,0 +1 @@ +RUN: llvm-rtdyld -printline %p/Inputs/arm_secdiff_reloc.o diff --git a/test/ExecutionEngine/RuntimeDyld/lit.local.cfg b/test/ExecutionEngine/RuntimeDyld/lit.local.cfg new file mode 100644 index 00000000000..df9b335dd13 --- /dev/null +++ b/test/ExecutionEngine/RuntimeDyld/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.test']