On Thu, 18 Apr 2024 at 20:51, Jonathan Wakely wrote:
>
> This completes the fixes to put all experimental symbols into
> libstdc++exp.a.
>
> On trunk the libstdc++_libbacktrace.a was removed completely and its
> contents aded to libstdc++exp.a instead. We don't want to do that on the
> gcc-13 branch because it will break makefiles using it. We can add the
> contents to libstdc++exp.a and then install a symlink so that
> -lstdc++_libbacktrace still works, but links to libstdc++exp.a instead.

It looks like simply duplicating all the libstdc___libbacktrace_FOO
variables in libbacktrace/Makefile.am does work (see attached patch),
so that we get an installed libstdc++_libbacktrace.a and a
not-installed libstdc++_libbacktraceconvenience.a which gets included
into the installed libstdc++exp.a

So if that's preferable to making the installed
libstdc++_libbacktrace.a a symlink, we can do that.

I still kinda like the symlink approach, because it reduces the size
on disk, and the same approach could be used to get rid of
libstdc++fs.a without breaking makefiles using -lstdc++fs
diff --git a/libstdc++-v3/src/experimental/Makefile.am b/libstdc++-v3/src/experimental/Makefile.am
index 6cdcdf3525d..db6f3321f90 100644
--- a/libstdc++-v3/src/experimental/Makefile.am
+++ b/libstdc++-v3/src/experimental/Makefile.am
@@ -31,7 +31,7 @@ filesystem_lib =
 endif
 
 if ENABLE_BACKTRACE
-backtrace_lib = $(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la
+backtrace_lib = $(top_builddir)/src/libbacktrace/libstdc++_libbacktraceconvenience.la
 else
 backtrace_lib =
 endif
diff --git a/libstdc++-v3/src/experimental/Makefile.in b/libstdc++-v3/src/experimental/Makefile.in
index 87e52c1c83f..709cc227a1f 100644
--- a/libstdc++-v3/src/experimental/Makefile.in
+++ b/libstdc++-v3/src/experimental/Makefile.in
@@ -149,7 +149,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++fsconvenience.la
-@ENABLE_BACKTRACE_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/libbacktrace/libstdc++_libbacktrace.la
+@ENABLE_BACKTRACE_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/libbacktrace/libstdc++_libbacktraceconvenience.la
 am__objects_1 = contract.lo
 am_libstdc__exp_la_OBJECTS = $(am__objects_1)
 libstdc__exp_la_OBJECTS = $(am_libstdc__exp_la_OBJECTS)
@@ -452,7 +452,7 @@ toolexeclib_LTLIBRARIES = libstdc++exp.la
 @ENABLE_FILESYSTEM_TS_FALSE@filesystem_lib = 
 @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
+@ENABLE_BACKTRACE_TRUE@backtrace_lib = $(top_builddir)/src/libbacktrace/libstdc++_libbacktraceconvenience.la
 headers = 
 sources = \
 	contract.cc
diff --git a/libstdc++-v3/src/libbacktrace/Makefile.am b/libstdc++-v3/src/libbacktrace/Makefile.am
index 4a08f11da1e..d45d60c8f69 100644
--- a/libstdc++-v3/src/libbacktrace/Makefile.am
+++ b/libstdc++-v3/src/libbacktrace/Makefile.am
@@ -31,18 +31,21 @@
 
 include $(top_srcdir)/fragment.am
 
-noinst_LTLIBRARIES = libstdc++_libbacktrace.la
+toolexeclib_LTLIBRARIES = libstdc++_libbacktrace.la
+noinst_LTLIBRARIES = libstdc++_libbacktraceconvenience.la
 
 ACLOCAL_AMFLAGS = -I ../.. -I ../../config
 
 # This will be used instead of the common AM_CPPFLAGS from fragment.am
-libstdc___libbacktrace_la_CPPFLAGS = \
+bt_cppflags = \
 	-I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
 	-I ../../../libgcc -I .. -I $(top_srcdir) \
 	-I $(top_srcdir)/../libbacktrace \
 	-I $(top_srcdir)/../libiberty \
 	-include $(top_srcdir)/src/libbacktrace/backtrace-rename.h \
 	$(BACKTRACE_CPPFLAGS)
+libstdc___libbacktrace_la_CPPFLAGS = $(bt_cppflags)
+libstdc___libbacktraceconvenience_la_CPPFLAGS = $(bt_cppflags)
 
 WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
 	     -Wcast-qual
@@ -61,8 +64,9 @@ obj_prefix = std_stacktrace
 
 # Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o
 libstdc___libbacktrace_la_SHORTNAME = $(obj_prefix)
+libstdc___libbacktraceconvenience_la_SHORTNAME = $(obj_prefix)
 
-libstdc___libbacktrace_la_SOURCES = \
+sources = \
 	atomic.c \
 	backtrace.c \
 	dwarf.c \
@@ -72,6 +76,8 @@ libstdc___libbacktrace_la_SOURCES = \
 	simple.c \
 	state.c \
 	cp-demangle.c
+libstdc___libbacktrace_la_SOURCES = $(sources)
+libstdc___libbacktraceconvenience_la_SOURCES = $(sources)
 
 FORMAT_FILES = \
 	elf.c \
@@ -86,19 +92,25 @@ ALLOC_FILES = \
 	alloc.c \
 	mmap.c
 
-EXTRA_libstdc___libbacktrace_la_SOURCES = \
+extra_sources = \
 	$(FORMAT_FILES) \
 	$(VIEW_FILES) \
 	$(ALLOC_FILES)
 
+EXTRA_libstdc___libbacktrace_la_SOURCES = $(extra_sources)
+EXTRA_libstdc___libbacktraceconvenience_la_SOURCES = $(extra_sources)
+
 # These three files are chosen by configure and added to the link.
 # We need the SHORTNAME- prefix so that they use the custom CPPFLAGS above.
-libstdc___libbacktrace_la_LIBADD = \
+conf_sources = \
 	$(obj_prefix)-$(FORMAT_FILE) \
 	$(obj_prefix)-$(VIEW_FILE) \
 	$(obj_prefix)-$(ALLOC_FILE)
+libstdc___libbacktrace_la_LIBADD = $(conf_sources)
+libstdc___libbacktraceconvenience_la_LIBADD = $(conf_sources)
 
-libstdc___libbacktrace_la_DEPENDENCIES = $(libstdc___libbacktrace_la_LIBADD)
+libstdc___libbacktrace_la_DEPENDENCIES = $(conf_sources)
+libstdc___libbacktraceconvenience_la_DEPENDENCIES = $(conf_sources)
 
 # Use symlinks for the sources
 
diff --git a/libstdc++-v3/src/libbacktrace/Makefile.in b/libstdc++-v3/src/libbacktrace/Makefile.in
index 6b898f65b06..681d014f3a7 100644
--- a/libstdc++-v3/src/libbacktrace/Makefile.in
+++ b/libstdc++-v3/src/libbacktrace/Makefile.in
@@ -150,18 +150,50 @@ DIST_COMMON = $(srcdir)/Makefile.am
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES = backtrace-supported.h
 CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-am_libstdc___libbacktrace_la_OBJECTS = $(obj_prefix)-atomic.lo \
-	$(obj_prefix)-backtrace.lo $(obj_prefix)-dwarf.lo \
-	$(obj_prefix)-fileline.lo $(obj_prefix)-posix.lo \
-	$(obj_prefix)-sort.lo $(obj_prefix)-simple.lo \
-	$(obj_prefix)-state.lo $(obj_prefix)-cp-demangle.lo
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)"
+LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
+am__objects_1 = $(obj_prefix)-atomic.lo $(obj_prefix)-backtrace.lo \
+	$(obj_prefix)-dwarf.lo $(obj_prefix)-fileline.lo \
+	$(obj_prefix)-posix.lo $(obj_prefix)-sort.lo \
+	$(obj_prefix)-simple.lo $(obj_prefix)-state.lo \
+	$(obj_prefix)-cp-demangle.lo
+am_libstdc___libbacktrace_la_OBJECTS = $(am__objects_1)
 libstdc___libbacktrace_la_OBJECTS =  \
 	$(am_libstdc___libbacktrace_la_OBJECTS)
 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 = 
+am_libstdc___libbacktraceconvenience_la_OBJECTS = $(am__objects_1)
+libstdc___libbacktraceconvenience_la_OBJECTS =  \
+	$(am_libstdc___libbacktraceconvenience_la_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -189,7 +221,9 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
 SOURCES = $(libstdc___libbacktrace_la_SOURCES) \
-	$(EXTRA_libstdc___libbacktrace_la_SOURCES)
+	$(EXTRA_libstdc___libbacktrace_la_SOURCES) \
+	$(libstdc___libbacktraceconvenience_la_SOURCES) \
+	$(EXTRA_libstdc___libbacktraceconvenience_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
@@ -456,11 +490,12 @@ WARN_CXXFLAGS = \
 
 # -I/-D flags to pass when compiling.
 AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS)
-noinst_LTLIBRARIES = libstdc++_libbacktrace.la
+toolexeclib_LTLIBRARIES = libstdc++_libbacktrace.la
+noinst_LTLIBRARIES = libstdc++_libbacktraceconvenience.la
 ACLOCAL_AMFLAGS = -I ../.. -I ../../config
 
 # This will be used instead of the common AM_CPPFLAGS from fragment.am
-libstdc___libbacktrace_la_CPPFLAGS = \
+bt_cppflags = \
 	-I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
 	-I ../../../libgcc -I .. -I $(top_srcdir) \
 	-I $(top_srcdir)/../libbacktrace \
@@ -468,6 +503,8 @@ libstdc___libbacktrace_la_CPPFLAGS = \
 	-include $(top_srcdir)/src/libbacktrace/backtrace-rename.h \
 	$(BACKTRACE_CPPFLAGS)
 
+libstdc___libbacktrace_la_CPPFLAGS = $(bt_cppflags)
+libstdc___libbacktraceconvenience_la_CPPFLAGS = $(bt_cppflags)
 C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable
 CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
 AM_CFLAGS = $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
@@ -478,7 +515,8 @@ obj_prefix = std_stacktrace
 
 # Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o
 libstdc___libbacktrace_la_SHORTNAME = $(obj_prefix)
-libstdc___libbacktrace_la_SOURCES = \
+libstdc___libbacktraceconvenience_la_SHORTNAME = $(obj_prefix)
+sources = \
 	atomic.c \
 	backtrace.c \
 	dwarf.c \
@@ -489,6 +527,8 @@ libstdc___libbacktrace_la_SOURCES = \
 	state.c \
 	cp-demangle.c
 
+libstdc___libbacktrace_la_SOURCES = $(sources)
+libstdc___libbacktraceconvenience_la_SOURCES = $(sources)
 FORMAT_FILES = \
 	elf.c \
 	pecoff.c \
@@ -502,20 +542,25 @@ ALLOC_FILES = \
 	alloc.c \
 	mmap.c
 
-EXTRA_libstdc___libbacktrace_la_SOURCES = \
+extra_sources = \
 	$(FORMAT_FILES) \
 	$(VIEW_FILES) \
 	$(ALLOC_FILES)
 
+EXTRA_libstdc___libbacktrace_la_SOURCES = $(extra_sources)
+EXTRA_libstdc___libbacktraceconvenience_la_SOURCES = $(extra_sources)
 
 # These three files are chosen by configure and added to the link.
 # We need the SHORTNAME- prefix so that they use the custom CPPFLAGS above.
-libstdc___libbacktrace_la_LIBADD = \
+conf_sources = \
 	$(obj_prefix)-$(FORMAT_FILE) \
 	$(obj_prefix)-$(VIEW_FILE) \
 	$(obj_prefix)-$(ALLOC_FILE)
 
-libstdc___libbacktrace_la_DEPENDENCIES = $(libstdc___libbacktrace_la_LIBADD)
+libstdc___libbacktrace_la_LIBADD = $(conf_sources)
+libstdc___libbacktraceconvenience_la_LIBADD = $(conf_sources)
+libstdc___libbacktrace_la_DEPENDENCIES = $(conf_sources)
+libstdc___libbacktraceconvenience_la_DEPENDENCIES = $(conf_sources)
 LTCOMPILE = \
 	$(LIBTOOL) --tag CC --tag disable-shared \
 	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -577,8 +622,46 @@ clean-noinstLTLIBRARIES:
 	  rm -f $${locs}; \
 	}
 
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
+	}
+
+uninstall-toolexeclibLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+	done
+
+clean-toolexeclibLTLIBRARIES:
+	-test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+	@list='$(toolexeclib_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}; \
+	}
+
 libstdc++_libbacktrace.la: $(libstdc___libbacktrace_la_OBJECTS) $(libstdc___libbacktrace_la_DEPENDENCIES) $(EXTRA_libstdc___libbacktrace_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(LINK)  $(libstdc___libbacktrace_la_OBJECTS) $(libstdc___libbacktrace_la_LIBADD) $(LIBS)
+	$(AM_V_CCLD)$(LINK) -rpath $(toolexeclibdir) $(libstdc___libbacktrace_la_OBJECTS) $(libstdc___libbacktrace_la_LIBADD) $(LIBS)
+
+libstdc++_libbacktraceconvenience.la: $(libstdc___libbacktraceconvenience_la_OBJECTS) $(libstdc___libbacktraceconvenience_la_DEPENDENCIES) $(EXTRA_libstdc___libbacktraceconvenience_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(LINK)  $(libstdc___libbacktraceconvenience_la_OBJECTS) $(libstdc___libbacktraceconvenience_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -704,6 +787,9 @@ check-am: all-am
 check: check-am
 all-am: Makefile $(LTLIBRARIES)
 installdirs:
+	for dir in "$(DESTDIR)$(toolexeclibdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
 install: install-am
 install-exec: install-exec-am
 install-data: install-data-am
@@ -737,7 +823,7 @@ maintainer-clean-generic:
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
-	mostlyclean-am
+	clean-toolexeclibLTLIBRARIES mostlyclean-am
 
 distclean: distclean-am
 	-rm -f Makefile
@@ -762,7 +848,7 @@ install-dvi: install-dvi-am
 
 install-dvi-am:
 
-install-exec-am:
+install-exec-am: install-toolexeclibLTLIBRARIES
 
 install-html: install-html-am
 
@@ -801,23 +887,25 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am:
+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-noinstLTLIBRARIES 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 \
 	install-html install-html-am install-info install-info-am \
 	install-man install-pdf install-pdf-am install-ps \
-	install-ps-am install-strip installcheck installcheck-am \
-	installdirs maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am
+	install-ps-am install-strip install-toolexeclibLTLIBRARIES \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-am uninstall uninstall-am \
+	uninstall-toolexeclibLTLIBRARIES
 
 .PRECIOUS: Makefile
 

Reply via email to