[PATCH 2/2] libstdc++: Use pthread_mutex_clocklock when TSan is active [PR121496]
Tomasz Kaminski
tkaminsk@redhat.com
Thu Aug 21 09:47:13 GMT 2025
On Thu, Aug 21, 2025 at 11:34 AM Jonathan Wakely <jwakely@redhat.com> wrote:
> This reverts r14-905-g3b7cb33033fbe6 which disabled the use of
> pthread_mutex_clocklock when TSan is active. That's no longer needed,
> because GCC has TSan interceptors for pthread_mutex_clocklock since GCC
> 15.1 and Clang has them since 18.1.0 (released March 2024).
>
> The interceptor was added by
> https://github.com/llvm/llvm-project/pull/75713
>
> libstdc++-v3/ChangeLog:
>
> PR libstdc++/121496
> * acinclude.m4 (GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK): Do not
> use _GLIBCXX_TSAN in _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK macro.
> * configure: Regenerate.
> ---
>
> Tested x86_64-linux.
>
This also looks good to me.
>
> We could backport this to GCC 15 but I might only do it for trunk,
> because it's possible that GCC 15 headers will be used with Clang
> versions older than 18.1.0 ... maybe?
>
> libstdc++-v3/acinclude.m4 | 2 +-
> libstdc++-v3/configure | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
> index 080a4fca9b57..027735eeeb3b 100644
> --- a/libstdc++-v3/acinclude.m4
> +++ b/libstdc++-v3/acinclude.m4
> @@ -4511,7 +4511,7 @@ AC_DEFUN([GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK], [
> [glibcxx_cv_PTHREAD_MUTEX_CLOCKLOCK=no])
> ])
> if test $glibcxx_cv_PTHREAD_MUTEX_CLOCKLOCK = yes; then
> - AC_DEFINE(_GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK, (_GLIBCXX_TSAN==0),
> [Define if pthread_mutex_clocklock is available in <pthread.h>.])
> + AC_DEFINE(_GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK, 1, [Define if
> pthread_mutex_clocklock is available in <pthread.h>.])
> fi
>
> CXXFLAGS="$ac_save_CXXFLAGS"
> diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
> index 4ad781a4b6e4..d57cfd581adc 100755
> --- a/libstdc++-v3/configure
> +++ b/libstdc++-v3/configure
> @@ -21881,7 +21881,7 @@ fi
> $as_echo "$glibcxx_cv_PTHREAD_MUTEX_CLOCKLOCK" >&6; }
> if test $glibcxx_cv_PTHREAD_MUTEX_CLOCKLOCK = yes; then
>
> -$as_echo "#define _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK
> (_GLIBCXX_TSAN==0)" >>confdefs.h
> +$as_echo "#define _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK 1" >>confdefs.h
>
> fi
>
> --
> 2.50.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20250821/d1f7d1e7/attachment.htm>
More information about the Libstdc++
mailing list