[mips][mcjit] Add support for R_MIPS_PC32.

Summary:
This allows us to resolve relocations for DW_EH_PE_pcrel TType encodings
in the exception handling LSDA.

Also fixed a nearby typo.

Reviewers: petarj, vkalintiris

Reviewed By: vkalintiris

Subscribers: vkalintiris, llvm-commits

Differential Revision: http://reviews.llvm.org/D10127

llvm-svn: 238844
This commit is contained in:
Daniel Sanders 2015-06-02 15:28:29 +00:00
parent 9139d0a501
commit 6d081f7d14
2 changed files with 11 additions and 1 deletions

View File

@ -480,7 +480,7 @@ void RuntimeDyldELF::resolveMIPSRelocation(const SectionEntry &Section,
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 @@ void RuntimeDyldELF::resolveMIPSRelocation(const SectionEntry &Section,
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;
}
}

View File

@ -8,6 +8,12 @@ R_MIPS_32:
.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