[JITLink] Fix a pointer-to-integer cast in jitlink::InProcessMemoryManager.
authorLang Hames <lhames@gmail.com>
Tue, 3 Mar 2020 21:51:05 +0000 (13:51 -0800)
committerLang Hames <lhames@gmail.com>
Tue, 3 Mar 2020 21:53:00 +0000 (13:53 -0800)
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.

llvm/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp

index 9e0d207..68ec9d7 100644 (file)
@@ -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());