https://sourceware.org/bugzilla/show_bug.cgi?id=25416
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|TLSDESC relaxation doesn |TLSDESC relaxation doesn't | |work for x32 --- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> --- For X32, TLSDESC generates 1. -maddress-mode=short lea foo@TLSDESC(%rip), %eax call *foo@TLSCALL(%eax) 2. -maddress-mode=long lea foo@TLSDESC(%rip), %rax call *foo@TLSCALL(%rax) Currently, I got [hjl@gnu-cfl-2 tls-x32]$ cat main.c #include <stdlib.h> #include <stdio.h> __thread int bar = 301; extern int *test1 (int); extern int *test2 (int); int main () { int *p; p = test1 (30); if (*p != 30) abort (); *p = 40; test1 (40); p = test2 (301); if (*p != 301) abort (); if (p != &bar) abort (); *p = 40; test2 (40); puts ("PASS"); return 0; } [hjl@gnu-cfl-2 tls-x32]$ cat tlsdes.S .text .p2align 4 .globl test1 .type test1, @function test1: .cfi_startproc subl $8, %esp .cfi_def_cfa_offset 16 lea foo@TLSDESC(%rip), %eax call *foo@TLSCALL(%eax) addl %fs:0, %eax cmpl %edi, (%eax) jne .L5 addl $8, %esp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L5: .cfi_restore_state call abort@PLT .cfi_endproc .size test1, .-test1 .p2align 4 .globl test2 .type test2, @function test2: .cfi_startproc subl $8, %esp .cfi_def_cfa_offset 16 lea bar@TLSDESC(%rip), %eax call *bar@TLSCALL(%eax) addl %fs:0, %eax cmpl %edi, (%eax) jne .L9 addl $8, %esp .cfi_remember_state .cfi_def_cfa_offset 8 ret .L9: .cfi_restore_state call abort@PLT .cfi_endproc .size test2, .-test2 .section .tdata,"awT",@progbits .align 4 .type foo, @object .size foo, 4 foo: .long 30 .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 tls-x32]$ gcc -mx32 tlsdes.S main.c /usr/local/bin/ld: /tmp/ccdQjj3W.o: TLS transition from R_X86_64_GOTPC32_TLSDESC to R_X86_64_TPOFF32 against `foo' at 0x5 in section `.text' failed collect2: error: ld returned 1 exit status [hjl@gnu-cfl-2 tls-x32]$ -- You are receiving this mail because: You are on the CC list for the bug.