Skip to content

Commit

Permalink
[JITLink] Fix endianness bug fedd32e.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lhames committed Apr 27, 2020
1 parent 05ef484 commit 7113a9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/ExecutionEngine/JITLink/MachO.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 7113a9a

Please sign in to comment.