[llvm] 7113a9a - [JITLink] Fix endianness bug fedd32e2fa36.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 10:43:39 PDT 2020


Author: Lang Hames
Date: 2020-04-27T10:40:11-07:00
New Revision: 7113a9a65445ed80332674f3e2be60db39969783

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

LOG: [JITLink] Fix endianness bug fedd32e2fa36.

The ByteSwap_NN functions return their result rather than modifying their
argument in-place, so we need to write the result back to CPUType here.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/JITLink/MachO.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO.cpp
index 2ef2f5e9409d..b3e45868ab22 100644
--- a/llvm/lib/ExecutionEngine/JITLink/MachO.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/MachO.cpp
@@ -65,7 +65,7 @@ void jitLink_MachO(std::unique_ptr<JITLinkContext> Ctx) {
     uint32_t CPUType;
     memcpy(&CPUType, Data.data() + 4, sizeof(uint32_t));
     if (Magic == MachO::MH_CIGAM_64)
-      ByteSwap_32(CPUType);
+      CPUType = ByteSwap_32(CPUType);
 
     LLVM_DEBUG({
       dbgs() << "jitLink_MachO: cputype = " << format("0x%08" PRIx32, CPUType)


        


More information about the llvm-commits mailing list