From a703f676f7354bea263bd17aed493f5977d488a0 Mon Sep 17 00:00:00 2001 From: Petar Jovanovic Date: Thu, 28 May 2015 13:48:41 +0000 Subject: [PATCH] [Mips64] Add support for MCJIT for MIPS64r2 and MIPS64r6 Add support for resolving MIPS64r2 and MIPS64r6 relocations in MCJIT. Patch by Vladimir Radosavljevic. Differential Revision: http://reviews.llvm.org/D9667 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238424 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../RuntimeDyld/RuntimeDyld.cpp | 3 +- .../RuntimeDyld/RuntimeDyldELF.cpp | 253 +++++++++++++++++- .../RuntimeDyld/RuntimeDyldELF.h | 25 +- .../RuntimeDyld/RuntimeDyldImpl.h | 7 + lib/Target/Mips/TargetInfo/MipsTargetInfo.cpp | 4 +- .../MCJIT/cross-module-sm-pic-a.ll | 2 +- test/ExecutionEngine/MCJIT/eh-lg-pic.ll | 2 +- test/ExecutionEngine/MCJIT/eh-sm-pic.ll | 2 +- .../MCJIT/multi-module-sm-pic-a.ll | 2 +- .../MCJIT/remote/cross-module-sm-pic-a.ll | 2 +- .../MCJIT/remote/multi-module-sm-pic-a.ll | 2 +- .../remote/test-global-init-nonzero-sm-pic.ll | 2 +- .../MCJIT/remote/test-ptr-reloc-sm-pic.ll | 2 +- test/ExecutionEngine/MCJIT/stubs-sm-pic.ll | 2 +- .../MCJIT/test-global-init-nonzero-sm-pic.ll | 2 +- .../MCJIT/test-ptr-reloc-sm-pic.ll | 2 +- .../OrcMCJIT/cross-module-sm-pic-a.ll | 2 +- test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll | 2 +- test/ExecutionEngine/OrcMCJIT/eh-sm-pic.ll | 2 +- .../OrcMCJIT/multi-module-sm-pic-a.ll | 2 +- .../OrcMCJIT/remote/cross-module-sm-pic-a.ll | 2 +- .../OrcMCJIT/remote/multi-module-sm-pic-a.ll | 2 +- .../remote/test-global-init-nonzero-sm-pic.ll | 2 +- .../OrcMCJIT/remote/test-ptr-reloc-sm-pic.ll | 2 +- test/ExecutionEngine/OrcMCJIT/stubs-sm-pic.ll | 2 +- .../test-global-init-nonzero-sm-pic.ll | 2 +- .../OrcMCJIT/test-ptr-reloc-sm-pic.ll | 2 +- .../Mips/ELF_Mips64r2N64_PIC_relocations.s | 155 +++++++++++ .../Mips/Inputs/ExternalFunction.ll | 4 + .../RuntimeDyld/Mips/lit.local.cfg | 3 + .../ExecutionEngine/MCJIT/MCJITCAPITest.cpp | 2 + .../ExecutionEngine/MCJIT/MCJITTestBase.h | 2 + 32 files changed, 469 insertions(+), 33 deletions(-) create mode 100644 test/ExecutionEngine/RuntimeDyld/Mips/ELF_Mips64r2N64_PIC_relocations.s create mode 100644 test/ExecutionEngine/RuntimeDyld/Mips/Inputs/ExternalFunction.ll create mode 100644 test/ExecutionEngine/RuntimeDyld/Mips/lit.local.cfg diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 24a3ec19aed..89535095dae 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -149,6 +149,7 @@ RuntimeDyldImpl::loadObjectImpl(const object::ObjectFile &Obj) { // Save information about our target Arch = (Triple::ArchType)Obj.getArch(); IsTargetLittleEndian = Obj.isLittleEndian(); + setMipsABI(Obj); // Compute the memory size required to load all sections to be loaded // and pass this information to the memory manager @@ -689,7 +690,7 @@ uint8_t *RuntimeDyldImpl::createStubFunction(uint8_t *Addr, // and stubs for branches Thumb - ARM and ARM - Thumb. writeBytesUnaligned(0xe51ff004, Addr, 4); // ldr pc,