public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r11-9301] libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133]
Date: Wed, 24 Nov 2021 11:52:19 +0000 (GMT)	[thread overview]
Message-ID: <20211124115219.A6D563857809@sourceware.org> (raw)

https://gcc.gnu.org/g:293075002a7eaf1e9d457a1839bcaf83f8626824

commit r11-9301-g293075002a7eaf1e9d457a1839bcaf83f8626824
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 9 23:45:36 2021 +0000

    libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133]
    
    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)

Diff:
---
 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 64f78df8eef..dc6979cf3f4 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


                 reply	other threads:[~2021-11-24 11:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211124115219.A6D563857809@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).