[llvm] 7113a9a - [JITLink] Fix endianness bug fedd32e2fa36.
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 27 13:01:23 PDT 2020
Please use the helpers in llvm/Support/Endian.h when possible. Using ByteSwap directly is confusing because you have to think about the host's endianness in addition to the endianness of the data.
-Eli
-----Original Message-----
From: llvm-commits <llvm-commits-bounces at lists.llvm.org> On Behalf Of Lang Hames via llvm-commits
Sent: Monday, April 27, 2020 10:44 AM
To: llvm-commits at lists.llvm.org
Subject: [EXT] [llvm] 7113a9a - [JITLink] Fix endianness bug fedd32e2fa36.
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)
_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list