From patchwork Wed Oct 13 09:44:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 46155 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9C7B73858414 for ; Wed, 13 Oct 2021 09:45:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C7B73858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1634118338; bh=xmPY6gor8Ef5IejC/vZ9wGkqgkvSDGIwx7/if9uuSJ4=; 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=PsudUJHPUPVv5FWWPdMEoBBXcXhBRpOo01dUbBt5m2Mpmjxa73tpUNnqd6zflLUF9 JDA2dD2b5qoObN7/7a6di5n2P9AJfcwRjyyyJEqQr67UWNDWKrJNPY7ZSiAubN/ZUB 6C7bwDxMNmri5YsGeYsufq/ZPJ4cSI1a25hHVY5w= 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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id D9E663858C27 for ; Wed, 13 Oct 2021 09:44:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D9E663858C27 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-166-87HHQaJHPMOAHLV9BIlrBg-1; Wed, 13 Oct 2021 05:44:35 -0400 X-MC-Unique: 87HHQaJHPMOAHLV9BIlrBg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7FBF618D6A25; Wed, 13 Oct 2021 09:44:34 +0000 (UTC) Received: from localhost (unknown [10.33.37.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC3CA60CA1; Wed, 13 Oct 2021 09:44:33 +0000 (UTC) Date: Wed, 13 Oct 2021 10:44:32 +0100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Ensure language linkage of std::__terminate() Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-13.8 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_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" On 11/10/21 20:38 +0100, Jonathan Wakely wrote: >On 08/10/21 12:23 +0100, Jonathan Wakely wrote: >>This adds an inline wrapper for std::terminate that doesn't add the >>declaration of std::terminate to namespace std. This allows the >>library to terminate without including all of . >> >>libstdc++-v3/ChangeLog: >> >> * include/bits/atomic_timed_wait.h: Remove unused header. >> * include/bits/c++config (std:__terminate): Define. >> * include/bits/semaphore_base.h: Remove and use >> __terminate instead of terminate. >> * include/bits/std_thread.h: Likewise. >> * libsupc++/eh_terminate.cc (std::terminate): Use qualified-id >> to call __cxxabiv1::__terminate. >> >> >>This avoids including a few thousand lines of just for one >>function declaration. Any objections or better ideas? > >I've pushed this to trunk now. And now I've pushed this fix for it too. Tested x86_64-linux. commit c1b6c360fcf3fc1c0045c7358d61a83c91b6fa25 Author: Jonathan Wakely Date: Wed Oct 13 10:35:44 2021 libstdc++: Ensure language linkage of std::__terminate() This is needed because people still find it necessary to do: extern "C" { #include } libstdc++-v3/ChangeLog: * include/bits/c++config (__terminate): Add extern "C++". diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index b76ffeb2562..a6495809671 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -296,7 +296,7 @@ namespace std // This allows the library to terminate without including all of // and without making the declaration of std::terminate visible to users. - __attribute__ ((__noreturn__, __always_inline__)) + extern "C++" __attribute__ ((__noreturn__, __always_inline__)) inline void __terminate() _GLIBCXX_USE_NOEXCEPT { void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__));