From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 03ABD3858CDB; Wed, 3 Aug 2022 12:30:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03ABD3858CDB MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-10928] libstdc++: Disable gthreads weak symbols for glibc 2.34 [PR103133] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 9fa411d75967ba5bb44d1a0bd2669608c4327dd2 X-Git-Newrev: 18eecb8c4a97716d4bc4890b05c91f172fadc7b3 Message-Id: <20220803123037.03ABD3858CDB@sourceware.org> Date: Wed, 3 Aug 2022 12:30:37 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2022 12:30:37 -0000 https://gcc.gnu.org/g:18eecb8c4a97716d4bc4890b05c91f172fadc7b3 commit r10-10928-g18eecb8c4a97716d4bc4890b05c91f172fadc7b3 Author: Jonathan Wakely 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 01bfa9ddd4f..cb842ea26aa 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