public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [gcc-13 PATCH 1/2] libstdc++: Fix libstdc++exp.a so it really does contain Filesystem TS symbols
Date: Thu, 18 Apr 2024 18:29:41 +0100	[thread overview]
Message-ID: <20240418195107.1281808-2-jwakely@redhat.com> (raw)
In-Reply-To: <20240418195107.1281808-1-jwakely@redhat.com>

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.

(cherry picked from commit abf40d2953639534af3428424f467adf3cb52177)
---
 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(-)

diff --git a/libstdc++-v3/src/experimental/Makefile.am b/libstdc++-v3/src/experimental/Makefile.am
index 1c7cea7e846..c5a38d882c2 100644
--- a/libstdc++-v3/src/experimental/Makefile.am
+++ b/libstdc++-v3/src/experimental/Makefile.am
@@ -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
diff --git a/libstdc++-v3/src/experimental/Makefile.in b/libstdc++-v3/src/experimental/Makefile.in
index 6f6b742c1cf..c16083a7fc8 100644
--- a/libstdc++-v3/src/experimental/Makefile.in
+++ b/libstdc++-v3/src/experimental/Makefile.in
@@ -148,7 +148,7 @@ am__uninstall_files_from_dir = { \
   }
 am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
-@ENABLE_FILESYSTEM_TS_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/src/filesystem/libstdc++fs.la
+@ENABLE_FILESYSTEM_TS_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/src/filesystem/libstdc++fsconvenience.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)
@@ -450,7 +450,7 @@ WARN_CXXFLAGS = \
 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_FILESYSTEM_TS_TRUE@filesystem_lib = $(top_builddir)/src/filesystem/libstdc++fsconvenience.la
 @ENABLE_BACKTRACE_FALSE@backtrace_lib = 
 @ENABLE_BACKTRACE_TRUE@backtrace_lib = $(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la
 headers = 
diff --git a/libstdc++-v3/src/filesystem/Makefile.am b/libstdc++-v3/src/filesystem/Makefile.am
index d2e1fde3f13..55f309b5c15 100644
--- a/libstdc++-v3/src/filesystem/Makefile.am
+++ b/libstdc++-v3/src/filesystem/Makefile.am
@@ -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
diff --git a/libstdc++-v3/src/filesystem/Makefile.in b/libstdc++-v3/src/filesystem/Makefile.in
index 852390ec1a9..76ba905087b 100644
--- a/libstdc++-v3/src/filesystem/Makefile.in
+++ b/libstdc++-v3/src/filesystem/Makefile.in
@@ -147,7 +147,7 @@ am__uninstall_files_from_dir = { \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
 am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
-LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
+LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
 libstdc__fs_la_LIBADD =
 @ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-dir.lo cow-ops.lo \
 @ENABLE_DUAL_ABI_TRUE@	cow-path.lo
@@ -158,6 +158,10 @@ AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
+libstdc__fsconvenience_la_LIBADD =
+am_libstdc__fsconvenience_la_OBJECTS = $(am__objects_2)
+libstdc__fsconvenience_la_OBJECTS =  \
+	$(am_libstdc__fsconvenience_la_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -184,7 +188,8 @@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
 am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
 am__v_CXXLD_0 = @echo "  CXXLD   " $@;
 am__v_CXXLD_1 = 
-SOURCES = $(libstdc__fs_la_SOURCES)
+SOURCES = $(libstdc__fs_la_SOURCES) \
+	$(libstdc__fsconvenience_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -449,7 +454,11 @@ WARN_CXXFLAGS = \
 
 # -I/-D flags to pass when compiling.
 AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS)
+
+# 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 = 
 @ENABLE_DUAL_ABI_FALSE@cxx11_abi_sources = 
 @ENABLE_DUAL_ABI_TRUE@cxx11_abi_sources = \
@@ -466,6 +475,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
@@ -565,6 +575,17 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; \
+	locs=`for p in $$list; do echo $$p; done | \
+	      sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+	      sort -u`; \
+	test -z "$$locs" || { \
+	  echo rm -f $${locs}; \
+	  rm -f $${locs}; \
+	}
+
 install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
 	@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
@@ -603,6 +624,9 @@ clean-toolexeclibLTLIBRARIES:
 libstdc++fs.la: $(libstdc__fs_la_OBJECTS) $(libstdc__fs_la_DEPENDENCIES) $(EXTRA_libstdc__fs_la_DEPENDENCIES) 
 	$(AM_V_CXXLD)$(CXXLINK) -rpath $(toolexeclibdir) $(libstdc__fs_la_OBJECTS) $(libstdc__fs_la_LIBADD) $(LIBS)
 
+libstdc++fsconvenience.la: $(libstdc__fsconvenience_la_OBJECTS) $(libstdc__fsconvenience_la_DEPENDENCIES) $(EXTRA_libstdc__fsconvenience_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(CXXLINK)  $(libstdc__fsconvenience_la_OBJECTS) $(libstdc__fsconvenience_la_LIBADD) $(LIBS)
+
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
 
@@ -715,8 +739,8 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool clean-toolexeclibLTLIBRARIES \
-	mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	clean-toolexeclibLTLIBRARIES mostlyclean-am
 
 distclean: distclean-am
 	-rm -f Makefile
@@ -785,8 +809,9 @@ uninstall-am: uninstall-toolexeclibLTLIBRARIES
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
-	clean-libtool clean-toolexeclibLTLIBRARIES cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
+	clean-libtool clean-noinstLTLIBRARIES \
+	clean-toolexeclibLTLIBRARIES cscopelist-am ctags ctags-am \
+	distclean distclean-compile distclean-generic \
 	distclean-libtool distclean-tags dvi dvi-am html html-am info \
 	info-am install install-am install-data install-data-am \
 	install-dvi install-dvi-am install-exec install-exec-am \
-- 
2.44.0


  reply	other threads:[~2024-04-18 19:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18 17:29 [gcc-13 PATCH 0/2] Replace libstdc++_libbacktrace.a with libstdc++exp.a Jonathan Wakely
2024-04-18 17:29 ` Jonathan Wakely [this message]
2024-04-25 16:23   ` [gcc-13 PATCH 1/2] libstdc++: Fix libstdc++exp.a so it really does contain Filesystem TS symbols Jonathan Wakely
2024-04-18 17:29 ` [gcc-13 PATCH 2/2] libstdc++: Add libstdc++_libbacktrace.a to libstdc++exp Jonathan Wakely
2024-04-18 20:34   ` Jonathan Wakely
2024-04-25 17:58     ` [gcc-13 PATCH 2/2 v3] " Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240418195107.1281808-2-jwakely@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).