Hi, This is a bit obscure. In my testing, for the purpose of upstreaming, of the glibc change to support ARM TLS descriptors in prelinked binaries (cf upstream BZ #17078, https://sourceware.org/bugzilla/show_bug.cgi?id=17078) I have come across a problem where all programs prelinked against glibc binaries using ARM TLS descriptors themselves segfaulted in the normal exit path, where libc.so's own TLS destructors are called. I have tracked it down to the GOT entry (pointed to by the DT_TLSDESC_GOT dynamic tag) meant to point to the lazy TLS descriptor resolver (pointed to by the DT_TLSDESC_PLT dynamic tag) being left uninitialised and therefore NULL. An attempt to call that resolver caused therefore a segfault.
The cause of this lack of initialisation turned out to be an omission in the original fix (dated 2011-04-13 in ChangeLog.cross), that didn't ensure that a conflict entry is created even for these R_ARM_TLS_DESC relocations that refer to a local symbol. Somehow it didn't trigger in testing back when implemented, perhaps glibc didn't require or access the missing entry in code handling TLS destructors then. Such an entry is needed, because for prelinked binaries the DT_TLSDESC_GOT GOT entry is only initialised by the dynamic linker when a conflict is resolved. The change below enforces this conflict entry creation. This fix removes 33 failures in prelink testing with glibc built using ARM TLS descriptors, that is with the `-mtls-dialect=gnu2' GCC option in effect (that is not the default unless explicitly requested at GCC build time): FAIL -> PASS: default/prelink.sum:cxx1.sh FAIL -> PASS: default/prelink.sum:cxx2.sh FAIL -> PASS: default/prelink.sum:cxx3.sh FAIL -> PASS: default/prelink.sum:layout1.sh FAIL -> PASS: default/prelink.sum:layout2.sh FAIL -> PASS: default/prelink.sum:reloc1.sh FAIL -> PASS: default/prelink.sum:reloc10.sh FAIL -> PASS: default/prelink.sum:reloc11.sh FAIL -> PASS: default/prelink.sum:reloc2.sh FAIL -> PASS: default/prelink.sum:reloc3.sh FAIL -> PASS: default/prelink.sum:reloc4.sh FAIL -> PASS: default/prelink.sum:reloc5.sh FAIL -> PASS: default/prelink.sum:reloc6.sh FAIL -> PASS: default/prelink.sum:reloc7.sh FAIL -> PASS: default/prelink.sum:reloc8.sh FAIL -> PASS: default/prelink.sum:reloc9.sh FAIL -> PASS: default/prelink.sum:shuffle1.sh FAIL -> PASS: default/prelink.sum:shuffle2.sh FAIL -> PASS: default/prelink.sum:shuffle3.sh FAIL -> PASS: default/prelink.sum:shuffle4.sh FAIL -> PASS: default/prelink.sum:shuffle5.sh FAIL -> PASS: default/prelink.sum:shuffle6.sh FAIL -> PASS: default/prelink.sum:shuffle7.sh FAIL -> PASS: default/prelink.sum:shuffle8.sh FAIL -> PASS: default/prelink.sum:shuffle9.sh FAIL -> PASS: default/prelink.sum:tls1.sh FAIL -> PASS: default/prelink.sum:tls2.sh FAIL -> PASS: default/prelink.sum:tls3.sh FAIL -> PASS: default/prelink.sum:tls4.sh FAIL -> PASS: default/prelink.sum:tls5.sh FAIL -> PASS: default/prelink.sum:tls6.sh FAIL -> PASS: default/prelink.sum:tls7.sh FAIL -> PASS: default/prelink.sum:undo1.sh Please apply. 2014-07-22 Maciej W. Rozycki <ma...@codesourcery.com> * src/arch-arm.c (arm_prelink_conflict_rel): Always create a conflict for R_ARM_TLS_DESC relocs. (arm_prelink_conflict_rela): Likewise. Maciej prelink-arm-tlsdesc-conflict-always.diff Index: trunk/src/arch-arm.c =================================================================== --- trunk.orig/src/arch-arm.c 2014-07-17 23:26:08.000000000 +0100 +++ trunk/src/arch-arm.c 2014-07-18 04:18:53.790564615 +0100 @@ -416,7 +416,9 @@ arm_prelink_conflict_rel (DSO *dso, stru case R_ARM_TLS_DTPMOD32: case R_ARM_TLS_TPOFF32: break; - + /* Likewise TLS_DESC. */ + case R_ARM_TLS_DESC: + break; default: return 0; } @@ -526,7 +528,9 @@ arm_prelink_conflict_rela (DSO *dso, str case R_ARM_TLS_DTPMOD32: case R_ARM_TLS_TPOFF32: break; - + /* Likewise TLS_DESC. */ + case R_ARM_TLS_DESC: + break; default: return 0; } -- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto