This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/59904] [ARM] tls-reload-1.c fails


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59904

--- Comment #7 from wangzheyu <tony.wang at arm dot com> ---
After a close analysis of your elf, it will fail due to bad code in first call
to function checktls23. The corresponding C code is:

 if (!y || *y++ != &tls23 || *y++ != &tls23_array[3]) return 0;

The code to get address of variable tls23 is wrongly fixed up. Here is the
assembly code with analysis embedded:

checktls23:
        push    {r4, lr}
        mov     r3, r0
        sub     r2, r0, #0
        beq     .L136
        ldr     r2, .L140 << get offset of variable tls23
        ldr     r1, [r0]
        bl      __aeabi_read_tp @ load_tp_soft  << get thread point and save it
to r0
        add     r0, r0, r2   << thread point plus offset equals address of
variable tls23
        mov     r2, #0
        cmp     r1, r0
        bne     .L136
        ldr     r4, .L140+4
        bl      __aeabi_read_tp @ load_tp_soft
        ldr     r1, [r3, #4]
        add     r0, r0, r4
        cmp     r1, r0
        bne     .L136
        add     r3, r3, #8
        mov     r2, r3
.L136:
        mov     r0, r2
        @ sp needed
        pop     {r4, pc}
.L141:
        .align  2
.L140:
        .word   .LANCHOR2(tpoff)+124  << offset of tls23 is correctly
generated. but never get correctly fixed up.
        .word   .LANCHOR3(tpoff)+12

So my advice is to use a newer version of binutils to test it again.

(In reply to christophe.lyon from comment #6)
> I have re-run the tests with trunk@210140 and older binutils (Sept 2013).
> 
> The test fails at compilation with target arm-none-linux-gnueabi, and
> CFLAGS=-Os  -pie -fpie or -Os  -pie -fPIE in the following configurations:
> --with-mode=arm --with-cpu=cortex-a9
> --with-mode=arm --with-cpu=cortex-a9 RUNTESTFLAGS=-mthumb
> --with-mode=thumb --with-cpu=cortex-a9
> --with-mode=thumb --with-cpu=cortex-a9 RUNTESTFLAGS=-marm
> 
> The test compiles OK and fails at execution with
> --with-mode=thumb --with-cpu=cortex-a9 RUNTESTFLAGS=-march=armv5t
> (this is the ELF file I have attached)
> 
> The compiles and runs OK with
> --with-mode=arm --with-cpu=cortex-a9 RUNTESTFLAGS=-march=armv5t


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]