[llvm] r238844 - [mips][mcjit] Add support for R_MIPS_PC32.
Daniel Sanders
daniel.sanders at imgtec.com
Tue Jun 2 08:28:30 PDT 2015
Author: dsanders
Date: Tue Jun 2 10:28:29 2015
New Revision: 238844
URL: http://llvm.org/viewvc/llvm-project?rev=238844&view=rev
Log:
[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
Modified:
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
llvm/trunk/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=238844&r1=238843&r2=238844&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Tue Jun 2 10:28:29 2015
@@ -480,7 +480,7 @@ void RuntimeDyldELF::resolveMIPSRelocati
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::resolveMIPSRelocati
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;
}
}
Modified: llvm/trunk/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s?rev=238844&r1=238843&r2=238844&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s (original)
+++ llvm/trunk/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s Tue Jun 2 10:28:29 2015
@@ -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
More information about the llvm-commits
mailing list