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

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 03:23:01 PST 2018


Merged to 6.0 in r323750.

On Tue, Jan 23, 2018 at 8:26 PM, Peter Smith via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> 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++;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180130/d3c8c01c/attachment.html>


More information about the llvm-commits mailing list