[lld] r323243 - [ELF] Make --fix-cortex-a53-843419 work on big endian hosts

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 11:26:52 PST 2018


Author: psmith
Date: Tue Jan 23 11:26:52 2018
New Revision: 323243

URL: http://llvm.org/viewvc/llvm-project?rev=323243&view=rev
Log:
[ELF] Make --fix-cortex-a53-843419 work on big endian hosts

The reinterpret cast to uint32_t to read the little-endian instructions 
will only work on a little endian system. Use ulittle32_t to always read
little-endian (AArch64 instructions are always little endian).

Fixes PR36056

Differential Revision: https://reviews.llvm.org/D42421

Modified:
    lld/trunk/ELF/AArch64ErrataFix.cpp

Modified: lld/trunk/ELF/AArch64ErrataFix.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/AArch64ErrataFix.cpp?rev=323243&r1=323242&r2=323243&view=diff
==============================================================================
--- lld/trunk/ELF/AArch64ErrataFix.cpp (original)
+++ lld/trunk/ELF/AArch64ErrataFix.cpp Tue Jan 23 11:26:52 2018
@@ -47,6 +47,7 @@
 using namespace llvm;
 using namespace llvm::ELF;
 using namespace llvm::object;
+using namespace llvm::support;
 using namespace llvm::support::endian;
 
 using namespace lld;
@@ -357,7 +358,7 @@ static uint64_t scanCortexA53Errata84341
 
   uint64_t PatchOff = 0;
   const uint8_t *Buf = IS->Data.begin();
-  const uint32_t *InstBuf = reinterpret_cast<const uint32_t *>(Buf + Off);
+  const ulittle32_t *InstBuf = reinterpret_cast<const ulittle32_t *>(Buf + Off);
   uint32_t Instr1 = *InstBuf++;
   uint32_t Instr2 = *InstBuf++;
   uint32_t Instr3 = *InstBuf++;




More information about the llvm-commits mailing list