summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2015-06-02 15:28:29 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2015-06-02 15:28:29 +0000
commitf85028359dd5a25deadc497de3c314612b1f404a (patch)
treebdc395d36ee2ff49fedb7ee99423f7b71f177a83
parentdb220dbf023b5c8573d7da2e951cf53a5e71cef7 (diff)
downloadbcm5719-llvm-f85028359dd5a25deadc497de3c314612b1f404a.tar.gz
bcm5719-llvm-f85028359dd5a25deadc497de3c314612b1f404a.zip
[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
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp6
-rw-r--r--llvm/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s6
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index 8679368d773..3bd8a477112 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -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;
}
}
diff --git a/llvm/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s b/llvm/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s
index c9f9e1fb7b2..d9216480671 100644
--- a/llvm/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s
+++ b/llvm/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s
@@ -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
OpenPOWER on IntegriCloud