[PATCH] [mips][mcjit] Add support for R_MIPS_PC32.
Daniel Sanders
daniel.sanders at imgtec.com
Fri May 29 09:24:35 PDT 2015
Hi petarj,
This allows us to resolve relocations for DW_EH_PE_pcrel TType encodings
in the exception handling LSDA.
Also fixed a nearby typo.
http://reviews.llvm.org/D10127
Files:
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s
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
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10127.26787.patch
Type: text/x-patch
Size: 1561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150529/198dd8bd/attachment.bin>
More information about the llvm-commits
mailing list