On Wed, Nov 16, 2016 at 11:56:07AM +0100, Markus Trippelsdorf wrote:
> When one uses ld.gold to build gcc, the thread sanitizer doesn't work,
> because gold is more conservative when applying TLS relaxations than
> ld.bfd. In this case a missing initial-exec attribute on a declaration
> causes gcc to assume the general dynamic model. With ld.bfd this gets
> relaxed to initial exec when linking the shared library, so the missing
> attribute doesn't matter. But ld.gold doesn't perform this optimization
> and this leads to crashes on tsan instrumented binaries.
> 
> See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78294
> and: https://sourceware.org/bugzilla/show_bug.cgi?id=20805
> 
> The fix is easy, just add the missing attribute.
> 
> (I don't think upstream needs this fix. They don't use shared tsan lib
> and clang doesn't need the fix anyway.)
> 
> Tested on X86_64 using ld.gold.
> 
> Ok for trunk and branches?
> 
> Thanks.
> 
>   PR sanitizer/78294
>   * tsan/tsan_rtl.cc: Add missing attribute.

Ok.
Please also update the LOCAL-PATCHES file in libsanitizer/ once Maxim
creates it (unless you submit it upstream).

        Jakub

Reply via email to