[llvm] ab16ef1 - [JITLink] Fix a pointer-to-integer cast in jitlink::InProcessMemoryManager.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 13:54:14 PST 2020


Author: Lang Hames
Date: 2020-03-03T13:53:00-08:00
New Revision: ab16ef17e838377e914a18fcec0fa78375833c36

URL: https://github.com/llvm/llvm-project/commit/ab16ef17e838377e914a18fcec0fa78375833c36
DIFF: https://github.com/llvm/llvm-project/commit/ab16ef17e838377e914a18fcec0fa78375833c36.diff

LOG: [JITLink] Fix a pointer-to-integer cast in jitlink::InProcessMemoryManager.

reinterpret_cast'ing the block base address directly to a uint64_t leaves the
high bits in an implementation-defined state, but JITLink expects them to be
zero. Switching to pointerToJITTargetAddress for the cast should fix this.

This should fix the jitlink test failures that we have seen on some of the
32-bit testers.

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
index 9e0d207e8bdb..68ec9d79af9b 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp
@@ -32,7 +32,7 @@ InProcessMemoryManager::allocate(const SegmentsRequestMap &Request) {
     }
     JITTargetAddress getTargetMemory(ProtectionFlags Seg) override {
       assert(SegBlocks.count(Seg) && "No allocation for segment");
-      return reinterpret_cast<JITTargetAddress>(SegBlocks[Seg].base());
+      return pointerToJITTargetAddress(SegBlocks[Seg].base());
     }
     void finalizeAsync(FinalizeContinuation OnFinalize) override {
       OnFinalize(applyProtections());


        


More information about the llvm-commits mailing list