Linux/ARM: Bus error with -O3 flag of clang/llvm-3.6 while running unit-test of .NET Core

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 01:39:17 PDT 2016


On 7 July 2016 at 08:26, Geunsik Lim <leemgs at gmail.com> wrote:
> Recently, I have got a strange phenomenon about this issue between real
> target device and our own linux/arm emulator.
>
> We cannot execute some unit tests on real target device (e.g., raspberry Pi2
> board , ARM Chromebook )
>
> Bus error
>
> Below is kernel log messages in case of the real target device.
> [91909.525677] Alignment trap: not handling instruction ed940b00 at
> [<b21db3d2>]
> [91909.525747] Unhandled fault: alignment exception (0x011) at 0xb1f7e3e3

Hi Geunsik Lim,

I'm not sure which emulator is this, but it's clear that it doesn't
care much for unaligned access, whereas your hardware does.

RPi2 is a Cortex-A7, the Chromebooks are Cortex-A15, both should
handle unaligned access, but they can still be se to crash via flags.

I can't see where in the function it breaks because your disassembly
dump didn't have the area where the PC was, but that being in
getI8LittleEndian, I'm assuming you're just iterating byte by byte.

An alternative to finding the bug in the board setting, would be to
*always* read a whole word (4 bytes) and re-order later, ie. instead
of reading as char*, read as int* or something.

Bottom line is, never trust your emulator. ;)

cheers,
--renato


More information about the llvm-commits mailing list