https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68824
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Dmitry Vyukov from comment #5) > In 3) did you mean -mstackrealign? No, I meant -mincoming-stack-boundary=3, -mstackrealign doesn't do anything in this case. > 1) looks like the simplest option. Are there any downsides? Of course, it will be a hassle for anybody who has any -fsanitize=thread linked code around, it will no longer be possible to mix tsan instrumented code between gcc 4.9/5 and gcc 6+, because having two different libtsan versions in one app won't work. Untested patch for 2) would be like: --- libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc.jj 2015-11-23 13:29:55.000000000 +0100 +++ libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc 2016-01-18 11:52:47.167981314 +0100 @@ -4215,8 +4215,10 @@ INTERCEPTOR(void *, __tls_get_addr, void return res; } #else +#ifndef INIT_TLS_GET_ADDR #define INIT_TLS_GET_ADDR #endif +#endif #if SANITIZER_INTERCEPT_LISTXATTR INTERCEPTOR(SSIZE_T, listxattr, const char *path, char *list, SIZE_T size) { --- libsanitizer/tsan/tsan_interceptors.cc.jj 2015-11-23 13:29:58.000000000 +0100 +++ libsanitizer/tsan/tsan_interceptors.cc 2016-01-18 11:54:04.792903073 +0100 @@ -2227,6 +2227,14 @@ static void HandleRecvmsg(ThreadState *t // Since the interceptor only initializes memory for msan, the simplest solution // is to disable the interceptor in tsan (other sanitizers do not call // signal handlers from COMMON_INTERCEPTOR_ENTER). +// As __tls_get_addr has been intercepted in the past, to avoid breaking +// libtsan ABI, keep it around, but just call the real function. +#if SANITIZER_INTERCEPT_TLS_GET_ADDR +#define INIT_TLS_GET_ADDR COMMON_INTERCEPT_FUNCTION(__tls_get_addr) +INTERCEPTOR(void *, __tls_get_addr, void *arg) { + return REAL(__tls_get_addr)(arg); +} +#endif #undef SANITIZER_INTERCEPT_TLS_GET_ADDR #define COMMON_INTERCEPT_FUNCTION(name) INTERCEPT_FUNCTION(name)