The patch from PR21412 is causing miscompilation of glibc. Anything that uses libpthread is crashing in __libc_dl_error_tsd. void ** __attribute__ ((const)) __libc_dl_error_tsd (void) { static __thread void *data; return &data; } When compiled without the patch: dl-tsd.os: file format elf64-ia64-little Disassembly of section .text: 0000000000000000 <__libc_dl_error_tsd>: 0: 18 08 15 06 80 05 [MMB] alloc r33=ar.pfs,5,3,0 1: LTOFF_DTPMOD22 data.6704 6: e0 00 04 00 48 00 addl r14=0,r1 c: 00 00 00 20 nop.b 0x0 10: 01 10 01 02 00 21 [MII] mov r34=r1 16: 00 02 00 62 00 80 mov r32=b0 1c: 04 00 00 84 mov r36=r0;; 20: 1d 18 01 1c 18 10 [MFB] ld8 r35=[r14] 22: PCREL21B __tls_get_addr 26: 00 00 00 02 00 00 nop.f 0x0 2c: 08 00 00 50 br.call.sptk.many b0=20 <__libc_dl_error_tsd+0x20>;; 30: 08 08 00 44 00 21 [MMI] mov r1=r34 36: 20 00 20 00 42 00 mov r2=r8 3c: 00 0a 00 07 mov b0=r32 40: 0b 00 00 00 01 00 [MMI] nop.m 0x0;; 41: DTPREL22 data.6704 46: 20 00 08 00 48 00 addl r2=0,r2 4c: 10 02 aa 00 mov.i ar.pfs=r33;; 50: 11 00 00 00 01 00 [MIB] nop.m 0x0 56: 80 00 08 00 42 80 mov r8=r2 5c: 08 00 84 00 br.ret.sptk.many b0;; When compiled with the patch: dl-tsd.os: file format elf64-ia64-little Disassembly of section .text: 0000000000000000 <__libc_dl_error_tsd>: 0: 08 08 15 06 80 05 [MMI] alloc r33=ar.pfs,5,3,0 1: LTOFF_DTPMOD22 data.6704 6: e0 00 04 00 48 00 addl r14=0,r1 c: 04 00 c4 00 mov r32=b0 10: 0b 10 01 02 00 21 [MMI] mov r34=r1;; 16: e0 00 38 30 20 80 ld8 r14=[r14] 1c: 04 00 00 84 mov r36=r0;; 20: 1d 18 01 1c 18 10 [MFB] ld8 r35=[r14] 22: PCREL21B __tls_get_addr 26: 00 00 00 02 00 00 nop.f 0x0 2c: 08 00 00 50 br.call.sptk.many b0=20 <__libc_dl_error_tsd+0x20>;; 30: 09 08 00 44 00 21 [MMI] mov r1=r34 36: 20 00 20 00 42 00 mov r2=r8 3c: 00 0a 00 07 mov b0=r32;; 40: 11 40 00 04 00 24 [MIB] addl r8=0,r2 40: DTPREL22 data.6704 46: 00 08 01 55 00 80 mov.i ar.pfs=r33 4c: 08 00 84 00 br.ret.sptk.many b0;; The bad version has one indirection on r14 too much.
-- Summary: [4.0 regression] TLS reference miscompiled Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schwab at suse dot de CC: gcc-bugs at gcc dot gnu dot org,rth at gcc dot gnu dot org GCC target triplet: ia64-linux OtherBugsDependingO 21412 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21657