Index: lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h =================================================================== --- lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h +++ lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h @@ -158,7 +158,10 @@ } case COFF::IMAGE_REL_I386_REL32: { // 32-bit relative displacement to the target. - uint64_t Result = Sections[RE.Sections.SectionA].getLoadAddress() - + uint64_t Result = + RE.Sections.SectionA == static_cast(-1) + ? Value + : Sections[RE.Sections.SectionA].getLoadAddress() - Section.getLoadAddress() + RE.Addend - 4 - RE.Offset; assert(static_cast(Result) <= INT32_MAX && "relocation overflow");