Re: [arm-gnu] Invalid unaligned access support for ARM Cortex-A8 in Sourcery G++ Lite 2011.03-41.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] Invalid unaligned access support for ARM Cortex-A8 in Sourcery G++ Lite 2011.03-41.



On 5/15/2011 8:27 AM, Maksim Galemin wrote:
Hi,

Preconditions:
Build system: Linux mgalemin-ThinkPad-R51e 2.6.39-1-generic-pae
#6-Ubuntu SMP Fri May 6 07:11:44 UTC 2011 i686 i686 i386 GNU/Linux
Cross-compiler: Sourcery G++ Lite 2011.03-41
Host kernel: 2.6.37-rc7 (from
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git,
tag "v2.6.39-rc7") with default config for OMAP3 - "omap2plus_defconfig"
Host hardware: Beagleboard-xM

Execution:
1. Checkout Linux kernel (tag "v2.6.39-rc7");
2. Make default kernel configuration for OMAP3 using
"omap2plus_defconfig" target;
3. Build kernel using Sourcery G++ Lite 2011.03-41 cross-compiler:
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm uImage

Expected results:
Kernel boots.

Results:
Kernel crashes with "Unhandled fault: alignment exception" (please see
attachment for details).

Workaround 1:
Force structures to be aligned. For example, for exception from the
attachment change size of "empty_str" array in function
"pcpu_dump_alloc_info" (file "mm/percpu.c") from:
char empty_str[] = "--------";
to:
char empty_str[16] = "--------";

Workaround 2:
Compile kernel with disabled "Unaligned access support":
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm
EXTRA_CFLAGS=-mno-unaligned-access uImage

Using unaligned loads is the default for ARMv6, ARMv7-A, ARMv7-R, and ARMv7-M, where the hardware handles the unaligned load (the same default is used by RealView). Note that hardware support for unaligned loads is *considerably* faster than a software unaligned handler.

If you disable the hardware support for unaligned loads (via A-bit/U-bit during reset) then you must either provide an unaligned load handler or compile with -mno-unaligned-access.

If you find that the compiler generated an invalid unaligned load with respect to the architecture standard, then we would need to see a test case.

Cheers,
Carlos.
--
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos@xxxxxxxxxxxxxxxx
+1 (650) 331-3385 x716