Runtime dynamic linker for MCJIT should support MIPS BigEndian architecture.
authorAkira Hatanaka <ahatanaka@mips.com>
Mon, 3 Dec 2012 23:12:19 +0000 (23:12 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Mon, 3 Dec 2012 23:12:19 +0000 (23:12 +0000)
This small change adds support for that. It will make all MCJIT tests pass
in make-check on BigEndian platforms.

Patch by Petar Jovanovic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169178 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h

index 3685fece1b59429dc3259047be69346fe2c222cf..648de79b89a9bf7c0311d11712f182b69e2b5616 100644 (file)
@@ -347,7 +347,7 @@ uint8_t *RuntimeDyldImpl::createStubFunction(uint8_t *Addr) {
     uint32_t *StubAddr = (uint32_t*)Addr;
     *StubAddr = 0xe51ff004; // ldr pc,<label>
     return (uint8_t*)++StubAddr;
-  } else if (Arch == Triple::mipsel) {
+  } else if (Arch == Triple::mipsel or Arch == Triple::mips) {
     uint32_t *StubAddr = (uint32_t*)Addr;
     // 0:   3c190000        lui     t9,%hi(addr).
     // 4:   27390000        addiu   t9,t9,%lo(addr).
index f5fd2e0d7ebdecdbba02a3d4842236493fe66c87..f32e3871b8282c2456addf8f6ee33fb141f0dc94 100644 (file)
@@ -677,7 +677,8 @@ void RuntimeDyldELF::processRelocationRef(const ObjRelocationInfo &Rel,
                         RelType, 0);
       Section.StubOffset += getMaxStubSize();
     }
-  } else if (Arch == Triple::mipsel && RelType == ELF::R_MIPS_26) {
+  } else if ((Arch == Triple::mipsel || Arch == Triple::mips) &&
+             RelType == ELF::R_MIPS_26) {
     // This is an Mips branch relocation, need to use a stub function.
     DEBUG(dbgs() << "\t\tThis is a Mips branch relocation.");
     SectionEntry &Section = Sections[Rel.SectionID];
index 829fd6c4c9a97626f6019e14d820bddf395ad44f..cfeb2b4b6a00fa82e02a64cc9a557c7bdbe2e1c3 100644 (file)
@@ -168,7 +168,7 @@ protected:
   inline unsigned getMaxStubSize() {
     if (Arch == Triple::arm || Arch == Triple::thumb)
       return 8; // 32-bit instruction and 32-bit address
-    else if (Arch == Triple::mipsel)
+    else if (Arch == Triple::mipsel or Arch == Triple::mips)
       return 16;
     else if (Arch == Triple::ppc64)
       return 44;