[poky] Bad ARM code with GCC 4.7.1

Gary Thomas gary at mlbassoc.com
Thu May 10 09:17:31 PDT 2012


On 2012-05-10 09:46, Khem Raj wrote:
> On Thu, May 10, 2012 at 7:28 AM, Gary Thomas<gary at mlbassoc.com>  wrote:
>> After updating to the latest master, I'm running into trouble
>> using GCC 4.7.1 with my ARM kernel(s).
>>
>
> whats your target arm architecture ? and kernel version ?

My board is DM3730, much like a BeagleBoard
   ARM architecture: armv7a
   Linux kernel 3.0

>
> gcc generate unaligned accesses by default
>
> Does adding -mno-unaligned-access to cflags help ?

I'll check.

>
>> The problem code is in mm/percpu.c - this function [header]
>>
>> static void pcpu_dump_alloc_info(const char *lvl,
>>                                  const struct pcpu_alloc_info *ai)
>> {
>>         int group_width = 1, cpu_width = 1, width;
>>         char empty_str[] = "--------";
>>         int alloc = 0, alloc_end = 0;
>>         int group, v;
>>         int upa, apl;   /* units per alloc, allocs per line */
>>
>> generates this code:
>>
>>    0xc03669d0<pcpu_dump_alloc_info>:   ldr     r3, [pc, #532]  ; 0xc0366bec
>> <pcpu_dump_alloc_info+540>
>>    0xc03669d4<pcpu_dump_alloc_info+4>: push    {r4, r5, r6, r7, r8, r9, r10,
>> r11, lr}
>>    0xc03669d8<pcpu_dump_alloc_info+8>: sub     sp, sp, #52     ; 0x34
>>    0xc03669dc<pcpu_dump_alloc_info+12>:        ldr     r2, [r3]
>>    0xc03669e0<pcpu_dump_alloc_info+16>:        mov     r4, r1
>>    0xc03669e4<pcpu_dump_alloc_info+20>:        mov     r10, r0
>>
>> which in turn generates an alignment exception at pcpu_dump_alloc_info+12

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------



More information about the poky mailing list