> I tried pr58066-3.patch on the above testcase, the code it generated > seems ok. I think after we change the 32bits pattern in i386.md to be > similar as 64bits pattern, we should change 32bit expand to be similar > as 64bit expand in legitimize_tls_address too? > > Thanks, > Wei. >
Sorry, I pasted the wrong code. This is the code generated by pr58066-3.patch. wmi@miwei:/tmp$ cat 1.c static __thread char ccc, bbb; int __cxa_get_globals() { return &ccc - &bbb; } wmi@miwei:/tmp$ ~/workarea/gcc-r208410-2/build/install/bin/gcc -O2 -fPIC -m32 -S 1.c wmi@miwei:/tmp$ cat 1.s .file "1.c" .section .text.unlikely,"ax",@progbits .LCOLDB0: .text .LHOTB0: .p2align 4,,15 .globl __cxa_get_globals .type __cxa_get_globals, @function __cxa_get_globals: .LFB0: .cfi_startproc pushl %ebx .cfi_def_cfa_offset 8 .cfi_offset 3, -8 call __x86.get_pc_thunk.bx addl $_GLOBAL_OFFSET_TABLE_, %ebx subl $8, %esp .cfi_def_cfa_offset 16 leal ccc@tlsldm(%ebx), %eax call ___tls_get_addr@PLT addl $8, %esp .cfi_def_cfa_offset 8 leal ccc@dtpoff(%eax), %edx leal bbb@dtpoff(%eax), %eax popl %ebx .cfi_restore 3 .cfi_def_cfa_offset 4 subl %eax, %edx movl %edx, %eax ret .cfi_endproc .LFE0: .size __cxa_get_globals, .-__cxa_get_globals .section .text.unlikely .LCOLDE0: .text .LHOTE0: .section .tbss,"awT",@nobits .type bbb, @object .size bbb, 1 bbb: .zero 1 .type ccc, @object .size ccc, 1 ccc: .zero 1 .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat .globl __x86.get_pc_thunk.bx .hidden __x86.get_pc_thunk.bx .type __x86.get_pc_thunk.bx, @function __x86.get_pc_thunk.bx: .LFB1: .cfi_startproc movl (%esp), %ebx .LFB1: .cfi_startproc movl (%esp), %ebx ret .cfi_endproc .LFE1: .ident "GCC: (GNU) 4.9.0 20140307 (experimental)" .section .note.GNU-stack,"",@progbits