From patchwork Fri Mar 12 17:46:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1452261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=SK2D/D+u; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DxtYR3m8xz9sRR for ; Sat, 13 Mar 2021 04:47:07 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DD2C7389783A; Fri, 12 Mar 2021 17:47:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD2C7389783A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1615571222; bh=aRJxhDYt4y0SZg9h0JUDXEO162q7JCfBpIb5dtLxPwU=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=SK2D/D+uyFSvDdVn7Dctsvp8eZG9iwVd1JlgRuS9O7n4xCCYBM4hsn0m8rFCEVFMp om5xr5zG09nZefSxKx7HvZM3JgAW7vPk+1LSQ3csKndATpHeSpV2Pu1PoHO7ulsC7L VQGGrPwOn0ssZdOjflaDwXmD5FCj0UyJhheNpxu8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 90F043893675 for ; Fri, 12 Mar 2021 17:46:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 90F043893675 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-472-N0OnfNF5OqmOmzMNpWTOmQ-1; Fri, 12 Mar 2021 12:46:56 -0500 X-MC-Unique: N0OnfNF5OqmOmzMNpWTOmQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 396861074659; Fri, 12 Mar 2021 17:46:55 +0000 (UTC) Received: from localhost (unknown [10.33.36.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2A4410023AF; Fri, 12 Mar 2021 17:46:54 +0000 (UTC) Date: Fri, 12 Mar 2021 17:46:54 +0000 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH 2/2] libstdc++: Remove symbols for new std::call_once implementation [PR 99341] Message-ID: <20210312174654.GM3008@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This removes the new symbols added for the new futex-based std::call_once implementation. These symbols were new on trunk, so not in any released version. However, they are already present in some beta distro releases (Fedora Linux 34) and in Fedora Linux rawhide. This change can be locally reverted by distros that need to keep the symbols present until affected packages have been rebuilt. libstdc++-v3/ChangeLog: PR libstdc++/99341 * config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Remove std::once_flag symbols. * config/abi/post/ia64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/pre/gnu.ver: Likewise. * src/c++11/mutex.cc [_GLIBCXX_HAVE_LINUX_FUTEX] (struct __once_flag_compat): Remove. (_ZNSt9once_flag11_M_activateEv): Remove. (_ZNSt9once_flag9_M_finishEb): Remove. Tested x86_64-linux, powerpc64-linux and powerpc64le-linux, but not yet committed (it's not really appropriate for a last-minute Friday change!) commit 621a5b5bcb27b0806af020beb1be8e75e050d308 Author: Jonathan Wakely Date: Fri Mar 12 11:47:20 2021 libstdc++: Remove symbols for new std::call_once implementation [PR 99341] This removes the new symbols added for the new futex-based std::call_once implementation. These symbols were new on trunk, so not in any released version. However, they are already present in some beta distro releases (Fedora Linux 34) and in Fedora Linux rawhide. This change can be locally reverted by distros that need to keep the symbols present until affected packages have been rebuilt. libstdc++-v3/ChangeLog: PR libstdc++/99341 * config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Remove std::once_flag symbols. * config/abi/post/ia64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/m68k-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Likewise. * config/abi/pre/gnu.ver: Likewise. * src/c++11/mutex.cc [_GLIBCXX_HAVE_LINUX_FUTEX] (struct __once_flag_compat): Remove. (_ZNSt9once_flag11_M_activateEv): Remove. (_ZNSt9once_flag9_M_finishEb): Remove. diff --git a/libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt index 45f1540ca11..898c8e1e895 100644 --- a/libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/aarch64-linux-gnu/baseline_symbols.txt @@ -4086,8 +4086,6 @@ FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2Em@@GLIBCXX FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev@@GLIBCXX_3.4 FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev@@GLIBCXX_3.4 FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED2Ev@@GLIBCXX_3.4 -FUNC:_ZNSt9once_flag11_M_activateEv@@GLIBCXX_3.4.29 -FUNC:_ZNSt9once_flag9_M_finishEb@@GLIBCXX_3.4.29 FUNC:_ZNSt9strstream3strEv@@GLIBCXX_3.4 FUNC:_ZNSt9strstream6freezeEb@@GLIBCXX_3.4 FUNC:_ZNSt9strstreamC1EPciSt13_Ios_Openmode@@GLIBCXX_3.4 diff --git a/libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt index 62d28d2cd04..92288ccb8a6 100644 --- a/libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/ia64-linux-gnu/baseline_symbols.txt @@ -4086,8 +4086,6 @@ FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2Em@@GLIBCXX FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev@@GLIBCXX_3.4 FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev@@GLIBCXX_3.4 FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED2Ev@@GLIBCXX_3.4 -FUNC:_ZNSt9once_flag11_M_activateEv@@GLIBCXX_3.4.29 -FUNC:_ZNSt9once_flag9_M_finishEb@@GLIBCXX_3.4.29 FUNC:_ZNSt9strstream3strEv@@GLIBCXX_3.4 FUNC:_ZNSt9strstream6freezeEb@@GLIBCXX_3.4 FUNC:_ZNSt9strstreamC1EPciSt13_Ios_Openmode@@GLIBCXX_3.4 diff --git a/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt index 45992aef3ec..af5dc020e00 100644 --- a/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/m68k-linux-gnu/baseline_symbols.txt @@ -4086,8 +4086,6 @@ FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2Ej@@GLIBCXX FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev@@GLIBCXX_3.4 FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev@@GLIBCXX_3.4 FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED2Ev@@GLIBCXX_3.4 -FUNC:_ZNSt9once_flag11_M_activateEv@@GLIBCXX_3.4.29 -FUNC:_ZNSt9once_flag9_M_finishEb@@GLIBCXX_3.4.29 FUNC:_ZNSt9strstream3strEv@@GLIBCXX_3.4 FUNC:_ZNSt9strstream6freezeEb@@GLIBCXX_3.4 FUNC:_ZNSt9strstreamC1EPciSt13_Ios_Openmode@@GLIBCXX_3.4 diff --git a/libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt b/libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt index 02a2e176bd7..6e5da521255 100644 --- a/libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt +++ b/libstdc++-v3/config/abi/post/riscv64-linux-gnu/baseline_symbols.txt @@ -4086,8 +4086,6 @@ FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEEC2Em@@GLIBCXX FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev@@GLIBCXX_3.4 FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev@@GLIBCXX_3.4 FUNC:_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED2Ev@@GLIBCXX_3.4 -FUNC:_ZNSt9once_flag11_M_activateEv@@GLIBCXX_3.4.29 -FUNC:_ZNSt9once_flag9_M_finishEb@@GLIBCXX_3.4.29 FUNC:_ZNSt9strstream3strEv@@GLIBCXX_3.4 FUNC:_ZNSt9strstream6freezeEb@@GLIBCXX_3.4 FUNC:_ZNSt9strstreamC1EPciSt13_Ios_Openmode@@GLIBCXX_3.4 diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index a2c151d11ac..5323c7f0604 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -2388,11 +2388,6 @@ GLIBCXX_3.4.29 { _ZNKRSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEv; _ZNSt7__cxx1118basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3strEONS_12basic_stringI[cw]S2_S3_EE; - # std::once_flag::_M_activate() - _ZNSt9once_flag11_M_activateEv; - # std::once_flag::_M_finish(bool) - _ZNSt9once_flag9_M_finishEb; - # std::to_chars(char*, char*, [float|double|long double]) _ZSt8to_charsPcS_[def]; # std::to_chars(char*, char*, [float|double|long double], chars_format) diff --git a/libstdc++-v3/src/c++11/mutex.cc b/libstdc++-v3/src/c++11/mutex.cc index 3b48998b7e4..646fd17ec45 100644 --- a/libstdc++-v3/src/c++11/mutex.cc +++ b/libstdc++-v3/src/c++11/mutex.cc @@ -26,90 +26,6 @@ #ifdef _GLIBCXX_HAS_GTHREADS -#if defined _GLIBCXX_SHARED && ! _GLIBCXX_INLINE_VERSION - -#ifdef _GLIBCXX_HAVE_LINUX_FUTEX -# include -# include -# include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION - -struct __once_flag_compat -{ - enum _Bits : int { _Init = 0, _Active = 1, _Done = 2 }; - int _M_once = 0; - bool _M_activate(); - void _M_finish(bool returning) noexcept; -}; - -bool -__once_flag_compat::_M_activate() -{ - if (__gnu_cxx::__is_single_threaded()) - { - if (_M_once == _Bits::_Done) - return false; - _M_once = _Bits::_Active; - return true; - } - - while (true) - { - int expected = _Bits::_Init; - constexpr int active = _Bits::_Active; - if (__atomic_compare_exchange_n(&_M_once, &expected, active, false, - __ATOMIC_ACQ_REL, - __ATOMIC_ACQUIRE)) - { - // This thread is now doing an active execution. - return true; - } - - if (expected == _Bits::_Done) - return false; // A returning execution happened, this is passive. - - // Otherwise, an active execution is happening. Wait for it to finish. - constexpr int futex_wait = 128; // FUTEX_WAIT_PRIVATE - syscall (SYS_futex, &_M_once, futex_wait, expected, 0); - } -} - -void -std::__once_flag_compat::_M_finish(bool returning) noexcept -{ - const int newval = returning ? _Bits::_Done : _Bits::_Init; - if (__gnu_cxx::__is_single_threaded()) - { - __glibcxx_assert(_M_once == _Bits::_Active); - _M_once = newval; - } - else - { - int prev [[maybe_unused]] - = __atomic_exchange_n(&_M_once, newval, __ATOMIC_RELEASE); - __glibcxx_assert(prev & _Bits::_Active); - // Wake any other threads waiting for this execution to finish. - constexpr int futex_wake = 129; // FUTEX_WAKE_PRIVATE - syscall (SYS_futex, &_M_once, futex_wake, INT_MAX); - } -} - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wattribute-alias" -extern "C" bool _ZNSt9once_flag11_M_activateEv() - __attribute__((alias ("_ZNSt18__once_flag_compat11_M_activateEv"))); -extern "C" void _ZNSt9once_flag9_M_finishEb() noexcept - __attribute__((alias ("_ZNSt18__once_flag_compat9_M_finishEb"))); -#pragma GCC diagnostic pop - -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std -#endif // FUTEX -#endif // ONCE_FLAG_COMPAT && SHARED && ! INLINE_VERSION - namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION