libstdc++: Fix libstdc++exp.a so it really does contain Filesystem TS symbols
Checks
Commit Message
This should fix the problem that libstdc++exp.a doesn't actually contain
the symbols from libstdc++fs.a, despite me claiming it did.
This increases the size of libstdc++exp.a considerably, because now it
really does contain what I intended it to contain. We might be able to
avoid that increased on-disk footprint by replacing the installed
version of libstdc++fs.a with a linker script that does
INPUT(-lstdc++exp.a) but for now duplicating things seems OK. Vendors
can replace libstdc++fs.a with a linker script if they want to.
This needs to be backported too, because on the gcc-13 branch both
libstdc++fs.a _and_ libstdc++_libbacktrace.a are installed, so libtool
ignores them both and libstdc++exp.a only contains the contract
violation handler. That makes r13-8207-g17acf9fbeb10d7 completely
useless until this fix gets backported.
-- >8 --
In r14-3812-gb96b554592c5cb I claimed that libstdc++exp.a now contains
all the symbols from libstdc++fs.a as well as libstdc++_libbacktrace.a,
but that wasn't true. Only the symbols from the latter were added to
libstdc++exp.a, the Filesystem TS ones weren't. This seems to be because
libtool won't combine static libs that are going to be installed
separately. Because libstdc++fs.a is still installed, libtool decides it
shouldn't be included in libstdc++exp.a.
The solution is similar to what we already do for libsupc++.a: build two
static libs, libstdc++fs.a and libstdc++fsconvenience.a, where the
former is installed and the latter isn't. If we then tell libtool to
include the latter in libstdc++exp.a it will do as it's told.
libstdc++-v3/ChangeLog:
* src/experimental/Makefile.am: Use libstdc++fsconvenience.a
instead of libstdc++fs.a.
* src/experimental/Makefile.in: Regenerate.
* src/filesystem/Makefile.am: Build libstdc++fsconvenience.a as
well.
* src/filesystem/Makefile.in: Regenerate.
---
libstdc++-v3/src/experimental/Makefile.am | 2 +-
libstdc++-v3/src/experimental/Makefile.in | 4 +--
libstdc++-v3/src/filesystem/Makefile.am | 4 +++
libstdc++-v3/src/filesystem/Makefile.in | 37 +++++++++++++++++++----
4 files changed, 38 insertions(+), 9 deletions(-)
Comments
On 02/02/24 12:14 +0000, Jonathan Wakely wrote:
>This should fix the problem that libstdc++exp.a doesn't actually contain
>the symbols from libstdc++fs.a, despite me claiming it did.
>
>This increases the size of libstdc++exp.a considerably, because now it
>really does contain what I intended it to contain. We might be able to
>avoid that increased on-disk footprint by replacing the installed
>version of libstdc++fs.a with a linker script that does
>INPUT(-lstdc++exp.a) but for now duplicating things seems OK. Vendors
Oops, that should be INPUT(-lstdc++exp) obviously, without the .a
extension.
>can replace libstdc++fs.a with a linker script if they want to.
@@ -25,7 +25,7 @@ include $(top_srcdir)/fragment.am
toolexeclib_LTLIBRARIES = libstdc++exp.la
if ENABLE_FILESYSTEM_TS
-filesystem_lib = $(top_builddir)/src/filesystem/libstdc++fs.la
+filesystem_lib = $(top_builddir)/src/filesystem/libstdc++fsconvenience.la
else
filesystem_lib =
endif
@@ -22,7 +22,10 @@
include $(top_srcdir)/fragment.am
+# Separate libstdc++fs.a to be installed.
toolexeclib_LTLIBRARIES = libstdc++fs.la
+# Duplicate lib that is to be part of libstdc++exp.a
+noinst_LTLIBRARIES = libstdc++fsconvenience.la
headers =
@@ -44,6 +47,7 @@ sources = \
# vpath % $(top_srcdir)/src/filesystem
libstdc__fs_la_SOURCES = $(sources)
+libstdc__fsconvenience_la_SOURCES = $(sources)
# 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