OSDN Git Service

[Orc] Stub addresses should be based on stub size, not pointer size.
authorLang Hames <lhames@gmail.com>
Tue, 2 Feb 2016 21:38:30 +0000 (21:38 +0000)
committerLang Hames <lhames@gmail.com>
Tue, 2 Feb 2016 21:38:30 +0000 (21:38 +0000)
This didn't affect X86_64, which is the only client of this code at the moment,
as stubs and pointers are both 8-bytes there. It will affect other platforms
though.

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

include/llvm/ExecutionEngine/Orc/OrcArchitectureSupport.h

index b5ef286..01558ee 100644 (file)
@@ -94,7 +94,7 @@ public:
   /// @brief Get a pointer to the stub at the given index, which must be in
   ///        the range 0 .. getNumStubs() - 1.
   void *getStub(unsigned Idx) const {
-    return static_cast<uint64_t *>(StubsMem.base()) + Idx;
+    return static_cast<char *>(StubsMem.base()) + Idx * StubSize;
   }
 
   /// @brief Get a pointer to the implementation-pointer at the given index,