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

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



Hello,

   I am trying to build something extremely simple:

#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-O0:

00008210 <main>:
    8210:       e92d4800        push    {fp, lr}
    8214:       e28db004        add     fp, sp, #4      ; 0x4
    8218:       e30202b4        movw    r0, #8884       ; 0x22b4
    821c:       e3400006        movt    r0, #6  ; 0x6
    8220:       eb0003ce        bl      9160 <_IO_puts>
    8224:       e3a03000        mov     r3, #0  ; 0x0
    8228:       e1a00003        mov     r0, r3
    822c:       e8bd8800        pop     {fp, pc}
  [ 6] .rodata           PROGBITS        000622b0 05a2b0 013990 00   A  0   0  8

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?

Thanks,

Laurent