From patchwork Tue Jan 9 12:33:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 186393 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp116918dyi; Tue, 9 Jan 2024 05:48:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9dnOvwZuf3ltVJ7fv+gUM8tABHBUg1vDOFExYM0AAPCJxjWdm/CCVjIwHPhUFWzHSqnNS X-Received: by 2002:a25:9782:0:b0:dbe:aab1:b0e3 with SMTP id i2-20020a259782000000b00dbeaab1b0e3mr2745664ybo.98.1704808101766; Tue, 09 Jan 2024 05:48:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704808101; cv=pass; d=google.com; s=arc-20160816; b=fkKGl8wXh3SsHOBj0v0qWzriZlAmKqZ1Eaaq/575RbTPxvtKI+alr+gR0h/Uc8YBjd +WUo938p3maBozwgueZSC7lm5eHQL3h0YpInOV/lEEYAcO1OrOLYsnqHIbSPXvBJy4kF 2P0TzSIrR093We0iiwKNGCK5IY4vZMIzBwv+1vPyZl6Jr4NqUUUydgOgWk7yEtUvoP0m sfZrw4Kr4yJwd8c0ZV5pXVhbDexGNgNQfaUdFEhrjmRnKPJWRUuQxJEXUw2jE63dMws/ MlV/XMdpHsFd7T1+gAfFlFUc08xcWALePw3GmDY9bSDu8oegbrmasnBDxYam11YxD/2g rTjQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=xufuOPumMj2soOF0S+jMmoQSrym7q5me3foB9/0dyGo=; fh=+kjIVHfBl297/DnRFlxs4K7vyYYhOUPEWYUZpsB9URw=; b=wz8hd/puDcqWz5zCccM2e0WwRDp0vau5mctNojSqND7MBzW0S4zIWz+imcvbd9FOnG ZKAJ4iAe59Yw9d/Q8bn5Q4UjfQplx2pMe/JG6cBzff+APNlVNqZs1N3RML1P5fNVXt/8 xF1oZ/kBFd9mNf1VBMkj+bojqXAmRdaXbLS9d86CjfYSP+u9+mwQpHrp0hmZsCfTnggv KNvF+IqLxjuQWOcSgsWUwmgKxvfFaXsMP8kQIHOBfityplpfX35y5nx9uQvXwG48oEnI 3v2AdY3clA+t1GlzKpR2ZiT+0gipLDf+Ck9u2EmemtIwNvbpgRd15MiQl//N7Eg6GFS+ wyng== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YIGZGLpW; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g11-20020ac87f4b000000b00429ae464f10si331580qtk.35.2024.01.09.05.48.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:48:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YIGZGLpW; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 87F14385C6E5 for ; Tue, 9 Jan 2024 12:44:39 +0000 (GMT) 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 ESMTPS id E9EE03858407 for ; Tue, 9 Jan 2024 12:43:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E9EE03858407 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E9EE03858407 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704804226; cv=none; b=EuKqu1J5FnuKOHTI7R4xTmWBx3PhlCJ37X9QpQGaP5SDFcV5X6qLl3zHFWih4JJgwSg1/dpX5goIt5loAFQou/Qn85pmUMg9k3YmTGHNzs9aXH5sTC4kAhOZtITExwrwAdP4UNV5oSb24qSwsujQj7Da9/E8Bl3X/fQy+2SdcdY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704804226; c=relaxed/simple; bh=veffxvmF+RK0UBvZNEyuRHpVUb7SFl1MxzI1l28XpYY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PHdiG77q1SXUG4HJyiil3Lzuh4KcXPD/ICpl83jvX1ZpBp+mJyaNZPIYeZE1nvzTj+T97CqDDDeG52s9kuIN/0/NHCMxjrEkguypWusIfTiNKBRfdj7HsYq2xAMrv3HgEMV16h6ua0VDMgtOYssMMeFCGYrCf/Kqa148qCu61TI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704804223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xufuOPumMj2soOF0S+jMmoQSrym7q5me3foB9/0dyGo=; b=YIGZGLpWZhExMI5lvQbCsFO2xCmyP99maZ3P+UmLH19aH1aI4ihGBvSZTtB0bTab8G7h28 97PrKqB6rBdg4ybuVhQTsnitMm7ZDTFC5Y7mojQlkLg28IoZLng9dtW+BVL1JUbgexCySL LgC+gcwNNEego6nMQrpE0tI188vwlvw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-438-2fk0M6ZXMq-m4tQIoHtcow-1; Tue, 09 Jan 2024 07:43:42 -0500 X-MC-Unique: 2fk0M6ZXMq-m4tQIoHtcow-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1C53185A782; Tue, 9 Jan 2024 12:43:41 +0000 (UTC) Received: from localhost (unknown [10.42.28.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id A4BE31C060B1; Tue, 9 Jan 2024 12:43:41 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Matthias Klose Subject: [PATCH][gcc-13] libstdc++: Add Filesystem TS and std::stacktrace symbols to libstdc++exp.a Date: Tue, 9 Jan 2024 12:33:10 +0000 Message-ID: <20240109124340.3886305-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787620860238857973 X-GMAIL-MSGID: 1787620860238857973 I was talking to Matthias Klose about enabling libstdc++_libbacktrace.a for Ubuntu's gcc package and I realised that it would be preferable if the gcc-13 branch had those libbacktrace symbols in libstdc++exp.a. I already did that for trunk with r14-3812-gb96b554592c5cb and trunk no longer installs libstdc++_libbacktrace.a at all. Removing libstdc++_libbacktrace.a for GCC 13.3 would be inappropriate for a stable release branch, so this partial backport duplicates the libstdc++_libbacktrace.a symbols in libstdc++exp.a but still installs libstdc++_libbacktrace.a as well. This gives users a smoother transition from GCC 13 to GCC 14. They can continue using -lstdc++_libbacktrace with GCC 13, or they can switch to -lstdc++exp now and be ready for GCC 14. Any objections? Tested x86_64-linux. If I push this I'll also add a 13.3 section to the bottom of https://gcc.gnu.org/gcc-13/changes.html#13.2 documenting it. -- >8 -- This consolidates the three static archives for extensions into one, so that -lstdc++exp can be used to provide the definitions of all unstable library features. For this gcc-13 backport libstdc++_libbacktrace.a is still installed, but its contents are duplicated in libstdc++exp.a. This means that users can start using -lstdc++exp with GCC 13.3 if they want, but existing Makefiles can continue to use -lstdc++_libbacktrace for any GCC 13.x release. The libstdc++fs.a archive is still installed, but its contents are duplicated in libstdc++exp.a now. This means -lstdc++exp can be used instead of -lstdc++fs. For targets using the GNU linker we should consider replacing libstdc++fs.a with a linker script that does INPUT(libstdc++exp.a). The tests for could be changed to use -lstdc++exp instead of -lstdc++fs, which would allow removing src/filesystem/.libs from the LDFLAGS in scripts/testsuite_flags.in, but that can be done at a later date. libstdc++-v3/ChangeLog: * doc/html/manual/*: Regenerate. * doc/xml/manual/using.xml: Update documentation on linking. * scripts/testsuite_flags.in: Adjust LDFLAGS to find libstdc++exp instead of libstdc++_libbacktrace. * src/c++20/Makefile.am: Fix comment. * src/c++20/Makefile.in: Regenerate. * src/experimental/Makefile.am: Use LIBADD to include other libraries. * src/experimental/Makefile.in: Regenerate. * testsuite/19_diagnostics/stacktrace/current.cc: Adjust dg-options to use -lstdc++exp. * testsuite/19_diagnostics/stacktrace/entry.cc: Likewise. * testsuite/19_diagnostics/stacktrace/stacktrace.cc: Likewise. * testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc: Likewise. (cherry picked from commit b96b554592c5cbb6a2c1797ffcb5706fd295f4fd) --- libstdc++-v3/doc/html/manual/using.html | 26 +++++++------ .../html/manual/using_dynamic_or_shared.html | 4 ++ libstdc++-v3/doc/xml/manual/using.xml | 37 ++++++++++--------- libstdc++-v3/scripts/testsuite_flags.in | 8 ++-- libstdc++-v3/src/c++20/Makefile.am | 2 +- libstdc++-v3/src/c++20/Makefile.in | 2 +- libstdc++-v3/src/experimental/Makefile.am | 18 +++++++++ libstdc++-v3/src/experimental/Makefile.in | 13 ++++++- .../19_diagnostics/stacktrace/current.cc | 2 +- .../19_diagnostics/stacktrace/entry.cc | 2 +- .../19_diagnostics/stacktrace/stacktrace.cc | 2 +- .../vector/debug/assign4_backtrace_neg.cc | 2 +- 12 files changed, 77 insertions(+), 41 deletions(-) diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml index 3a507fc1671..7276cad0feb 100644 --- a/libstdc++-v3/doc/xml/manual/using.xml +++ b/libstdc++-v3/doc/xml/manual/using.xml @@ -100,30 +100,27 @@ - - -lstdc++fs - Linking to libstdc++fs - is required for use of the Filesystem library extensions in - <experimental/filesystem>. - - - -lstdc++exp - Linking to libstdc++exp - is required for use of the C++ Contracts extensions enabled by - -fcontracts. + Linking to libstdc++exp.a + is required for use of experimental C++ library features. + This currently provides support for the C++23 types defined in the + <stacktrace> header, + the Filesystem library extensions defined in the + <experimental/filesystem> + header, + and the Contracts extensions enabled by -fcontracts. - -lstdc++_libbacktrace - Until C++23 support is non-experimental, linking to - libstdc++_libbacktrace.a - is required for use of the C++23 type - std::stacktrace - and related types in - <stacktrace>. + -lstdc++fs + Linking to libstdc++fs.a + is another way to use the Filesystem library extensions defined in the + <experimental/filesystem> + header. + The libstdc++exp.a library + also provides all the symbols contained in this library. @@ -1710,6 +1707,10 @@ A quick read of the relevant part of the GCC and link with . The library implementation is incomplete on non-POSIX platforms, specifically Windows is only partially supported. + Since GCC 14, libstdc++exp.a + also contains the definitions for this library, + so can be used instead of + . diff --git a/libstdc++-v3/scripts/testsuite_flags.in b/libstdc++-v3/scripts/testsuite_flags.in index 18748f0f9ce..8bf4918287a 100755 --- a/libstdc++-v3/scripts/testsuite_flags.in +++ b/libstdc++-v3/scripts/testsuite_flags.in @@ -78,14 +78,14 @@ case ${query} in ;; --cxxldflags) FS_LDFLAGS= - BT_LDFLAGS= + EXP_LDFLAGS= if [ -d ${BUILD_DIR}/src/filesystem/.libs ]; then FS_LDFLAGS=-L${BUILD_DIR}/src/filesystem/.libs fi - if [ -d ${BUILD_DIR}/src/libbacktrace/.libs ]; then - BT_LDFLAGS=-L${BUILD_DIR}/src/libbacktrace/.libs + if [ -d ${BUILD_DIR}/src/experimental/.libs ]; then + EXP_LDFLAGS=-L${BUILD_DIR}/src/experimental/.libs fi - SECTIONLDFLAGS="@SECTION_LDFLAGS@ @LIBICONV@ $FS_LDFLAGS $BT_LDFLAGS" + SECTIONLDFLAGS="@SECTION_LDFLAGS@ @LIBICONV@ $FS_LDFLAGS $EXP_LDFLAGS" echo ${SECTIONLDFLAGS} ;; *) diff --git a/libstdc++-v3/src/c++20/Makefile.am b/libstdc++-v3/src/c++20/Makefile.am index 0bc8a7b832a..e947855e6ae 100644 --- a/libstdc++-v3/src/c++20/Makefile.am +++ b/libstdc++-v3/src/c++20/Makefile.am @@ -22,7 +22,7 @@ include $(top_srcdir)/fragment.am -# Convenience library for C++17 runtime. +# Convenience library for C++20 runtime. noinst_LTLIBRARIES = libc++20convenience.la headers = diff --git a/libstdc++-v3/src/experimental/Makefile.am b/libstdc++-v3/src/experimental/Makefile.am index 3b962e7d804..1c7cea7e846 100644 --- a/libstdc++-v3/src/experimental/Makefile.am +++ b/libstdc++-v3/src/experimental/Makefile.am @@ -24,6 +24,18 @@ include $(top_srcdir)/fragment.am toolexeclib_LTLIBRARIES = libstdc++exp.la +if ENABLE_FILESYSTEM_TS +filesystem_lib = $(top_builddir)/src/filesystem/libstdc++fs.la +else +filesystem_lib = +endif + +if ENABLE_BACKTRACE +backtrace_lib = $(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la +else +backtrace_lib = +endif + headers = sources = \ @@ -33,6 +45,12 @@ sources = \ libstdc__exp_la_SOURCES = $(sources) +libstdc__exp_la_LIBADD = \ + $(filesystem_lib) $(backtrace_lib) + +libstdc__exp_la_DEPENDENCIES = \ + $(filesystem_lib) $(backtrace_lib) + # AM_CXXFLAGS needs to be in each subdirectory so that it can be # modified in a per-library or per-sub-library way. Need to manually # set this option because CONFIG_CXXFLAGS has to be after diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc index 184e23b460e..f6c860fc7a4 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc @@ -1,4 +1,4 @@ -// { dg-options "-std=gnu++23 -lstdc++_libbacktrace" } +// { dg-options "-std=gnu++23 -lstdc++exp" } // { dg-do run { target c++23 } } // { dg-require-effective-target stacktrace } diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc index a222c425b20..f0406953d03 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc @@ -1,4 +1,4 @@ -// { dg-options "-std=gnu++23 -lstdc++_libbacktrace" } +// { dg-options "-std=gnu++23 -lstdc++exp" } // { dg-do run { target c++23 } } // { dg-require-effective-target stacktrace } diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc index 8dfdf4739be..0a358b7b8ff 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc @@ -1,4 +1,4 @@ -// { dg-options "-std=gnu++23 -lstdc++_libbacktrace" } +// { dg-options "-std=gnu++23 -lstdc++exp" } // { dg-do run { target c++23 } } // { dg-require-effective-target stacktrace } diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc index 520788d5cb7..43a82fb1201 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc @@ -1,5 +1,5 @@ // { dg-do run { xfail *-*-* } } -// { dg-options "-D_GLIBCXX_DEBUG_BACKTRACE -lstdc++_libbacktrace" } +// { dg-options "-D_GLIBCXX_DEBUG_BACKTRACE -lstdc++exp" } // { dg-require-effective-target stacktrace } #include