Re: [arm-gnu] Static linking problem with Cortex-A8 on 2008q1-126
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] Static linking problem with Cortex-A8 on 2008q1-126



Laurent Desnogues wrote:
#include <stdio.h>

int main(void)
{
  printf("%s\n", "0");

  return 0;
}

Using these two command-lines:

arm-none-linux-gnueabi-gcc -static -O0 -mcpu=cortex-a8 string.c -o string-O0
arm-none-linux-gnueabi-gcc -static -O1 -mcpu=cortex-a8 string.c -o string-O1
In string-O1:

00008210 <main>:
    8210:       e92d4010        push    {r4, lr}
    8214:       e3040080        movw    r0, #16512      ; 0x4080
    8218:       e3400000        movt    r0, #0  ; 0x0
    821c:       eb0003cf        bl      9160 <_IO_puts>
    8220:       e3a00000        mov     r0, #0  ; 0x0
    8224:       e8bd8010        pop     {r4, pc}
  [ 6] .rodata           PROGBITS        000622b0 05a2b0 013988 00   A  0   0  8

It looks like the "0" string is not correctly relocated with -O1.

Am I doing something utterly stupid or is there a bug somewhere?

I can reproduce this issue on 2008q1-126.

This is most likely a bug in the MOVT/MOVT relocation. There was at least one fix relating to MOVW/MOVT relocation processing in and around the time of the 2008q1-126 release.

The issue does not appear in Sourcery G++ for ARM GNU/Linux 4.2-173.

There is no easy workaround for this issue. Mark might have an idea though.

Cheers,
Carlos.
--
Carlos O'Donell
CodeSourcery
carlos@xxxxxxxxxxxxxxxx
(650) 331-3385 x716