Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp =================================================================== --- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -480,7 +480,7 @@ uint32_t *TargetPtr = (uint32_t *)(Section.Address + Offset); Value += Addend; - DEBUG(dbgs() << "resolveMipselocation, LocalAddress: " + DEBUG(dbgs() << "resolveMIPSRelocation, LocalAddress: " << Section.Address + Offset << " FinalAddress: " << format("%p", Section.LoadAddress + Offset) << " Value: " << format("%x", Value) << " Type: " << format("%x", Type) @@ -504,6 +504,10 @@ case ELF::R_MIPS_LO16: *TargetPtr = ((*TargetPtr) & 0xffff0000) | (Value & 0xffff); break; + case ELF::R_MIPS_PC32: + uint32_t FinalAddress = (Section.LoadAddress + Offset); + writeBytesUnaligned(Value + Addend - FinalAddress, (uint8_t *)TargetPtr, 4); + break; } } Index: test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s =================================================================== --- test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s +++ test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s @@ -12,6 +12,12 @@ .word foo # rtdyld-check: *{4}(R_MIPS_32+4) = foo .4byte foo +# rtdyld-check: *{4}(R_MIPS_PC32) = foo - R_MIPS_PC32 +R_MIPS_PC32: + .word foo-. +# rtdyld-check: *{4}(R_MIPS_PC32 + 4) = foo - tmp1 +tmp1: + .4byte foo-tmp1 .text .abicalls