* [committed] libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133]
@ 2021-11-10 12:05 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-11-10 12:05 UTC (permalink / raw)
To: libstdc++, gcc-patches
Tested powerpc64le-linux, glibc 2.17 and 2.34, pushed to trunk.
We also want something like this for musl-based targets. And Florian has
suggested we should also disable the weak symbols for libstdc++.a, but
those need more work.
...
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.
---
libstdc++-v3/config/os/gnu-linux/os_defines.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libstdc++-v3/config/os/gnu-linux/os_defines.h b/libstdc++-v3/config/os/gnu-linux/os_defines.h
index d5bb2a1886e..3a053454195 100644
--- a/libstdc++-v3/config/os/gnu-linux/os_defines.h
+++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h
@@ -61,4 +61,10 @@
(__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
--
2.31.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-10 12:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 12:05 [committed] libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133] Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).