From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id E1E9E3858001; Wed, 10 Jan 2024 21:58:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E1E9E3858001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704923902; bh=8ShmomVflGHnZEpjDptSAVGTh8dX2wa7ROt5I/FmYtA=; h=From:To:Subject:Date:From; b=XUxZhcrDcfL1lLQ9C0XeZCcOtgTwL4KnqLAgopiDp8jPQ6WhEYgXv3pQ5CS0ZhbPg B1shRea2BLC5r1kkdZZRLhVSx1LW6UOEVSPLdUJqSrKu8sA7h3U7c3V0+c4cdIk6Cn tfdT9YS4cWx14lL/ndT6kh5tASpq2QRNtUfcYxgI= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-8207] libstdc++: Add Filesystem TS and std::stacktrace symbols to libstdc++exp.a X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 40e16fda0f4be0420873eb8a9ebaca8ee0b1363e X-Git-Newrev: 17acf9fbeb10d7adad3455368d5ad5d4aefe3175 Message-Id: <20240110215822.E1E9E3858001@sourceware.org> Date: Wed, 10 Jan 2024 21:58:22 +0000 (GMT) List-Id: https://gcc.gnu.org/g:17acf9fbeb10d7adad3455368d5ad5d4aefe3175 commit r13-8207-g17acf9fbeb10d7adad3455368d5ad5d4aefe3175 Author: Jonathan Wakely Date: Thu Sep 7 10:24:56 2023 +0100 libstdc++: Add Filesystem TS and std::stacktrace symbols to libstdc++exp.a 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) Diff: --- libstdc++-v3/doc/html/manual/using.html | 26 ++++++++------- .../doc/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 +++++++- .../testsuite/19_diagnostics/stacktrace/current.cc | 2 +- .../testsuite/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/html/manual/using.html b/libstdc++-v3/doc/html/manual/using.html index eebb35da279..e8e0c6c0e85 100644 --- a/libstdc++-v3/doc/html/manual/using.html +++ b/libstdc++-v3/doc/html/manual/using.html @@ -28,18 +28,20 @@ -latomicLinking to libatomic is required for some uses of ISO C++11 <atomic>. - -lstdc++fsLinking to libstdc++fs - is required for use of the Filesystem library extensions in - <experimental/filesystem>. - -lstdc++expLinking to libstdc++exp - is required for use of the C++ Contracts extensions enabled by - -fcontracts. - -lstdc++_libbacktraceUntil 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++expLinking 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++fsLinking 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. -fopenmpFor parallel mode.-ltbbLinking to tbb (Thread Building Blocks) is required for use of the Parallel Standard Algorithms and execution policies in <execution>. diff --git a/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html b/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html index 46ccbc55c33..f1e727800c2 100644 --- a/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html +++ b/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html @@ -138,6 +138,10 @@ A quick read of the relevant part of the GCC and link with -lstdc++fs. 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 -lstdc++exp can be used instead of + -lstdc++fs.

GCC 13 includes an implementation of the C++ Contracts library defined by P1429R3. 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/c++20/Makefile.in b/libstdc++-v3/src/c++20/Makefile.in index 23aba3d62d4..3ec8c5ce804 100644 --- a/libstdc++-v3/src/c++20/Makefile.in +++ b/libstdc++-v3/src/c++20/Makefile.in @@ -422,7 +422,7 @@ WARN_CXXFLAGS = \ # -I/-D flags to pass when compiling. AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS) -# Convenience library for C++17 runtime. +# Convenience library for C++20 runtime. noinst_LTLIBRARIES = libc++20convenience.la headers = # XTEMPLATE_FLAGS = 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/src/experimental/Makefile.in b/libstdc++-v3/src/experimental/Makefile.in index 671f0703bcb..6f6b742c1cf 100644 --- a/libstdc++-v3/src/experimental/Makefile.in +++ b/libstdc++-v3/src/experimental/Makefile.in @@ -148,7 +148,8 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(toolexeclibdir)" LTLIBRARIES = $(toolexeclib_LTLIBRARIES) -libstdc__exp_la_LIBADD = +@ENABLE_FILESYSTEM_TS_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/src/filesystem/libstdc++fs.la +@ENABLE_BACKTRACE_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la am__objects_1 = contract.lo am_libstdc__exp_la_OBJECTS = $(am__objects_1) libstdc__exp_la_OBJECTS = $(am_libstdc__exp_la_OBJECTS) @@ -448,6 +449,10 @@ WARN_CXXFLAGS = \ # -I/-D flags to pass when compiling. AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS) toolexeclib_LTLIBRARIES = libstdc++exp.la +@ENABLE_FILESYSTEM_TS_FALSE@filesystem_lib = +@ENABLE_FILESYSTEM_TS_TRUE@filesystem_lib = $(top_builddir)/src/filesystem/libstdc++fs.la +@ENABLE_BACKTRACE_FALSE@backtrace_lib = +@ENABLE_BACKTRACE_TRUE@backtrace_lib = $(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la headers = sources = \ contract.cc @@ -455,6 +460,12 @@ sources = \ # vpath % $(top_srcdir)/src/experimental 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 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