]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 9 Nov 2021 23:45:36 +0000 (23:45 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 3 Aug 2022 09:52:41 +0000 (10:52 +0100)
Since Glibc 2.34 all pthreads symbols are defined directly in libc not
libpthread, and since Glibc 2.32 we have used __libc_single_threaded to
avoid unnecessary locking in single-threaded programs. This means there
is no reason to avoid linking to libpthread now, and so no reason to use
weak symbols defined in gthr-posix.h for all the pthread_xxx functions.

libstdc++-v3/ChangeLog:

PR libstdc++/100748
PR libstdc++/103133
* config/os/gnu-linux/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK):
Define for glibc 2.34 and later.

(cherry picked from commit 80fe172ba9820199c2bbce5d0611ffca27823049)

libstdc++-v3/config/os/gnu-linux/os_defines.h

index 01bfa9ddd4f28419f41e6106249e3cecb8fe76a6..cb842ea26aaa5aa1621cbad1b2836ef62f4a0e2a 100644 (file)
   (__gthread_active_p() ? __gthread_self() : (__gthread_t)1)
 #endif
 
+#if __GLIBC_PREREQ(2, 34)
+// Since glibc 2.34 all pthreads functions are usable without linking to
+// libpthread.
+# define _GLIBCXX_GTHREAD_USE_WEAK 0
+#endif
+
 #endif