public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5713] libstdc++: Enable building libstdc++.{a, so} when !HOSTED
@ 2023-02-06 14:24 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-02-06 14:24 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:abdea447250e994c2de95a68cbc79d312cc54863

commit r13-5713-gabdea447250e994c2de95a68cbc79d312cc54863
Author: Arsen Arsenović <arsen@aarsen.me>
Date:   Thu Oct 20 17:49:50 2022 +0200

    libstdc++: Enable building libstdc++.{a,so} when !HOSTED
    
    This enables us to provide symbols for placeholders and numeric limits,
    and allows users to mess about with linker flags less.
    
    libstdc++-v3/ChangeLog:
    
            * Makefile.am [!_GLIBCXX_HOSTED]: Enable src/ subdirectory.
            * Makefile.in: Regenerate.
            * src/Makefile.am [!_GLIBCXX_HOSTED]: Omit compatibility files.
            There's no history to be compatible with.
            * src/c++11/Makefile.am [!_GLIBCXX_HOSTED]: Omit hosted-only
            source files from the build.
            * src/c++17/Makefile.am [!_GLIBCXX_HOSTED]: Likewise.
            * src/c++20/Makefile.am [!_GLIBCXX_HOSTED]: Likewise.
            * src/c++98/Makefile.am [!_GLIBCXX_HOSTED]: Likewise.
            * src/Makefile.in: Regenerate.
            * src/c++11/Makefile.in: Regenerate.
            * src/c++17/Makefile.in: Regenerate.
            * src/c++20/Makefile.in: Regenerate.
            * src/c++98/Makefile.in: Regenerate.
    
    Reviewed-by: Jonathan Wakely <jwakely@redhat.com>

Diff:
---
 libstdc++-v3/Makefile.am           |  4 ++--
 libstdc++-v3/Makefile.in           |  4 ++--
 libstdc++-v3/src/Makefile.am       |  6 ++++++
 libstdc++-v3/src/Makefile.in       |  8 ++++++--
 libstdc++-v3/src/c++11/Makefile.am | 16 +++++++++++++---
 libstdc++-v3/src/c++11/Makefile.in | 37 ++++++++++++++++++++++++-------------
 libstdc++-v3/src/c++17/Makefile.am |  4 ++++
 libstdc++-v3/src/c++17/Makefile.in |  6 ++++--
 libstdc++-v3/src/c++20/Makefile.am |  4 ++++
 libstdc++-v3/src/c++20/Makefile.in |  6 ++++--
 libstdc++-v3/src/c++98/Makefile.am |  4 ++++
 libstdc++-v3/src/c++98/Makefile.in |  6 ++++--
 12 files changed, 77 insertions(+), 28 deletions(-)

diff --git a/libstdc++-v3/Makefile.am b/libstdc++-v3/Makefile.am
index 81e3b06228f..5fbf393bfdf 100644
--- a/libstdc++-v3/Makefile.am
+++ b/libstdc++-v3/Makefile.am
@@ -24,11 +24,11 @@ include $(top_srcdir)/fragment.am
 
 if GLIBCXX_HOSTED
 ## Note that python must come after src.
-  hosted_source = src doc po testsuite python
+  hosted_source = doc po testsuite python
 endif
 
 ## Keep this list sync'd with acinclude.m4:GLIBCXX_CONFIGURE.
-SUBDIRS = include libsupc++ $(hosted_source)
+SUBDIRS = include libsupc++ src $(hosted_source)
 
 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
index e6a5a5ce3dd..500c0d75282 100644
--- a/libstdc++-v3/Makefile.in
+++ b/libstdc++-v3/Makefile.in
@@ -420,8 +420,8 @@ WARN_CXXFLAGS = \
 
 # -I/-D flags to pass when compiling.
 AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS)
-@GLIBCXX_HOSTED_TRUE@hosted_source = src doc po testsuite python
-SUBDIRS = include libsupc++ $(hosted_source)
+@GLIBCXX_HOSTED_TRUE@hosted_source = doc po testsuite python
+SUBDIRS = include libsupc++ src $(hosted_source)
 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
 @BUILD_XML_FALSE@STAMP_XML = 
 
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 97a5363b40a..8cbf34a19e8 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -128,7 +128,13 @@ cxx11_sources = \
 	${cxx0x_compat_sources} \
 	${ldbl_alt128_compat_sources}
 
+if GLIBCXX_HOSTED
 libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources)
+else
+# When freestanding, there's currently no compatibility to preserve.  Should
+# that change, any compatibility sources can be added here.
+libstdc___la_SOURCES =
+endif
 
 libstdc___la_LIBADD = \
 	$(GLIBCXX_LIBS) \
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index e38b70df9fb..10fd9aa0daf 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -162,7 +162,8 @@ am__objects_2 = compatibility.lo compatibility-debug_list.lo \
 @GLIBCXX_LDBL_ALT128_COMPAT_TRUE@	compatibility-ldbl-alt128.lo \
 @GLIBCXX_LDBL_ALT128_COMPAT_TRUE@	$(am__objects_4)
 am__objects_6 = $(am__objects_3) $(am__objects_5)
-am_libstdc___la_OBJECTS = $(am__objects_2) $(am__objects_6)
+@GLIBCXX_HOSTED_TRUE@am_libstdc___la_OBJECTS = $(am__objects_2) \
+@GLIBCXX_HOSTED_TRUE@	$(am__objects_6)
 libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
 @VTV_CYGMIN_FALSE@am_libstdc___la_rpath = -rpath $(toolexeclibdir)
 @VTV_CYGMIN_TRUE@am_libstdc___la_rpath = -rpath $(toolexeclibdir)
@@ -539,7 +540,10 @@ cxx11_sources = \
 	${cxx0x_compat_sources} \
 	${ldbl_alt128_compat_sources}
 
-libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources)
+# When freestanding, there's currently no compatibility to preserve.  Should
+# that change, any compatibility sources can be added here.
+@GLIBCXX_HOSTED_FALSE@libstdc___la_SOURCES = 
+@GLIBCXX_HOSTED_TRUE@libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources)
 libstdc___la_LIBADD = \
 	$(GLIBCXX_LIBS) \
 	$(top_builddir)/libsupc++/libsupc++convenience.la \
diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am
index a99c9c3c02b..682be1669a4 100644
--- a/libstdc++-v3/src/c++11/Makefile.am
+++ b/libstdc++-v3/src/c++11/Makefile.am
@@ -51,6 +51,10 @@ else
 cxx11_abi_sources =
 endif
 
+sources_freestanding = \
+	limits.cc \
+	placeholders.cc
+
 sources = \
 	chrono.cc \
 	codecvt.cc \
@@ -66,9 +70,7 @@ sources = \
 	hashtable_c++0x.cc \
 	ios.cc \
 	ios_errcat.cc \
-	limits.cc \
 	mutex.cc \
-	placeholders.cc \
 	random.cc \
 	regex.cc  \
 	shared_ptr.cc \
@@ -118,7 +120,15 @@ endif
 
 vpath % $(top_srcdir)/src/c++11
 
-libc__11convenience_la_SOURCES = $(sources)  $(inst_sources)
+if !GLIBCXX_HOSTED
+libc__11convenience_la_SOURCES = $(sources_freestanding)
+else
+libc__11convenience_la_SOURCES = \
+	$(sources_freestanding) \
+	$(sources) \
+	$(inst_sources)
+endif
+
 
 # Use special rules for the hashtable.cc file so that all
 # the generated template functions are also instantiated.
diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in
index 77e11a9fd1d..e7a09fe3246 100644
--- a/libstdc++-v3/src/c++11/Makefile.in
+++ b/libstdc++-v3/src/c++11/Makefile.in
@@ -121,26 +121,26 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libc__11convenience_la_LIBADD =
-@ENABLE_DUAL_ABI_TRUE@am__objects_1 = cow-locale_init.lo \
+am__objects_1 = limits.lo placeholders.lo
+@ENABLE_DUAL_ABI_TRUE@am__objects_2 = cow-locale_init.lo \
 @ENABLE_DUAL_ABI_TRUE@	cow-shim_facets.lo cxx11-hash_tr1.lo \
 @ENABLE_DUAL_ABI_TRUE@	cxx11-ios_failure.lo \
 @ENABLE_DUAL_ABI_TRUE@	cxx11-shim_facets.lo cxx11-stdexcept.lo
-am__objects_2 = ctype_configure_char.lo ctype_members.lo
-am__objects_3 = chrono.lo codecvt.lo condition_variable.lo \
+am__objects_3 = ctype_configure_char.lo ctype_members.lo
+am__objects_4 = chrono.lo codecvt.lo condition_variable.lo \
 	cow-stdexcept.lo ctype.lo debug.lo functexcept.lo \
 	functional.lo futex.lo future.lo hash_c++0x.lo \
-	hashtable_c++0x.lo ios.lo ios_errcat.lo limits.lo mutex.lo \
-	placeholders.lo random.lo regex.lo shared_ptr.lo \
-	snprintf_lite.lo system_error.lo thread.lo $(am__objects_1) \
-	$(am__objects_2)
-@ENABLE_DUAL_ABI_TRUE@am__objects_4 = cow-fstream-inst.lo \
+	hashtable_c++0x.lo ios.lo ios_errcat.lo mutex.lo random.lo \
+	regex.lo shared_ptr.lo snprintf_lite.lo system_error.lo \
+	thread.lo $(am__objects_2) $(am__objects_3)
+@ENABLE_DUAL_ABI_TRUE@am__objects_5 = cow-fstream-inst.lo \
 @ENABLE_DUAL_ABI_TRUE@	cow-sstream-inst.lo cow-string-inst.lo \
 @ENABLE_DUAL_ABI_TRUE@	cow-string-io-inst.lo \
 @ENABLE_DUAL_ABI_TRUE@	cow-wstring-inst.lo \
 @ENABLE_DUAL_ABI_TRUE@	cow-wstring-io-inst.lo \
 @ENABLE_DUAL_ABI_TRUE@	cxx11-locale-inst.lo \
 @ENABLE_DUAL_ABI_TRUE@	cxx11-wlocale-inst.lo sso_string.lo
-@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_5 = $(am__objects_4) \
+@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_6 = $(am__objects_5) \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	ext11-inst.lo fstream-inst.lo \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	ios-inst.lo iostream-inst.lo \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	istream-inst.lo locale-inst.lo \
@@ -149,7 +149,11 @@ am__objects_3 = chrono.lo codecvt.lo condition_variable.lo \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	string-io-inst.lo wlocale-inst.lo \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	wstring-inst.lo \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	wstring-io-inst.lo
-am_libc__11convenience_la_OBJECTS = $(am__objects_3) $(am__objects_5)
+@GLIBCXX_HOSTED_FALSE@am_libc__11convenience_la_OBJECTS =  \
+@GLIBCXX_HOSTED_FALSE@	$(am__objects_1)
+@GLIBCXX_HOSTED_TRUE@am_libc__11convenience_la_OBJECTS =  \
+@GLIBCXX_HOSTED_TRUE@	$(am__objects_1) $(am__objects_4) \
+@GLIBCXX_HOSTED_TRUE@	$(am__objects_6)
 libc__11convenience_la_OBJECTS = $(am_libc__11convenience_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -466,6 +470,10 @@ host_sources = \
 @ENABLE_DUAL_ABI_TRUE@	cxx11-shim_facets.cc \
 @ENABLE_DUAL_ABI_TRUE@	cxx11-stdexcept.cc
 
+sources_freestanding = \
+	limits.cc \
+	placeholders.cc
+
 sources = \
 	chrono.cc \
 	codecvt.cc \
@@ -481,9 +489,7 @@ sources = \
 	hashtable_c++0x.cc \
 	ios.cc \
 	ios_errcat.cc \
-	limits.cc \
 	mutex.cc \
-	placeholders.cc \
 	random.cc \
 	regex.cc  \
 	shared_ptr.cc \
@@ -526,7 +532,12 @@ sources = \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	wstring-inst.cc \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	wstring-io-inst.cc
 
-libc__11convenience_la_SOURCES = $(sources)  $(inst_sources)
+@GLIBCXX_HOSTED_FALSE@libc__11convenience_la_SOURCES = $(sources_freestanding)
+@GLIBCXX_HOSTED_TRUE@libc__11convenience_la_SOURCES = \
+@GLIBCXX_HOSTED_TRUE@	$(sources_freestanding) \
+@GLIBCXX_HOSTED_TRUE@	$(sources) \
+@GLIBCXX_HOSTED_TRUE@	$(inst_sources)
+
 
 # Rewrite the type info for __ios_failure.
 @ENABLE_DUAL_ABI_TRUE@rewrite_ios_failure_typeinfo = sed -e '/^_*_ZTISt13__ios_failure:/,/_ZTVN10__cxxabiv120__si_class_type_infoE/s/_ZTVN10__cxxabiv120__si_class_type_infoE/_ZTVSt19__iosfail_type_info/'
diff --git a/libstdc++-v3/src/c++17/Makefile.am b/libstdc++-v3/src/c++17/Makefile.am
index 901b177f8f2..30e693a54df 100644
--- a/libstdc++-v3/src/c++17/Makefile.am
+++ b/libstdc++-v3/src/c++17/Makefile.am
@@ -60,7 +60,11 @@ sources = \
 
 vpath % $(top_srcdir)/src/c++17
 
+if GLIBCXX_HOSTED
 libc__17convenience_la_SOURCES = $(sources)  $(inst_sources)
+else
+libc__17convenience_la_SOURCES =
+endif
 
 if GLIBCXX_LDBL_ALT128_COMPAT
 floating_from_chars.lo: floating_from_chars.cc
diff --git a/libstdc++-v3/src/c++17/Makefile.in b/libstdc++-v3/src/c++17/Makefile.in
index 84bba4d2048..fe5c9ffce5f 100644
--- a/libstdc++-v3/src/c++17/Makefile.in
+++ b/libstdc++-v3/src/c++17/Makefile.in
@@ -128,7 +128,8 @@ am__objects_2 = floating_from_chars.lo floating_to_chars.lo fs_dir.lo \
 @ENABLE_DUAL_ABI_TRUE@am__objects_3 = cow-string-inst.lo
 @ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_4 = ostream-inst.lo \
 @ENABLE_EXTERN_TEMPLATE_TRUE@	string-inst.lo $(am__objects_3)
-am_libc__17convenience_la_OBJECTS = $(am__objects_2) $(am__objects_4)
+@GLIBCXX_HOSTED_TRUE@am_libc__17convenience_la_OBJECTS =  \
+@GLIBCXX_HOSTED_TRUE@	$(am__objects_2) $(am__objects_4)
 libc__17convenience_la_OBJECTS = $(am_libc__17convenience_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -455,7 +456,8 @@ sources = \
 	memory_resource.cc \
 	$(extra_fs_sources)
 
-libc__17convenience_la_SOURCES = $(sources)  $(inst_sources)
+@GLIBCXX_HOSTED_FALSE@libc__17convenience_la_SOURCES = 
+@GLIBCXX_HOSTED_TRUE@libc__17convenience_la_SOURCES = $(sources)  $(inst_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/c++20/Makefile.am b/libstdc++-v3/src/c++20/Makefile.am
index 4bb017ce926..0bc8a7b832a 100644
--- a/libstdc++-v3/src/c++20/Makefile.am
+++ b/libstdc++-v3/src/c++20/Makefile.am
@@ -53,7 +53,11 @@ tzdb.o: tzdb.cc tzdata.zi.h
 	$(CXXCOMPILE) -I. -c $<
 endif
 
+if GLIBCXX_HOSTED
 libc__20convenience_la_SOURCES = $(sources)  $(inst_sources)
+else
+libc__20convenience_la_SOURCES =
+endif
 
 # 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/c++20/Makefile.in b/libstdc++-v3/src/c++20/Makefile.in
index fceda34cbcc..23aba3d62d4 100644
--- a/libstdc++-v3/src/c++20/Makefile.in
+++ b/libstdc++-v3/src/c++20/Makefile.in
@@ -123,7 +123,8 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
 libc__20convenience_la_LIBADD =
 am__objects_1 = tzdb.lo
 @ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = sstream-inst.lo
-am_libc__20convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2)
+@GLIBCXX_HOSTED_TRUE@am_libc__20convenience_la_OBJECTS =  \
+@GLIBCXX_HOSTED_TRUE@	$(am__objects_1) $(am__objects_2)
 libc__20convenience_la_OBJECTS = $(am_libc__20convenience_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -432,7 +433,8 @@ headers =
 @ENABLE_EXTERN_TEMPLATE_TRUE@	sstream-inst.cc
 
 sources = tzdb.cc
-libc__20convenience_la_SOURCES = $(sources)  $(inst_sources)
+@GLIBCXX_HOSTED_FALSE@libc__20convenience_la_SOURCES = 
+@GLIBCXX_HOSTED_TRUE@libc__20convenience_la_SOURCES = $(sources)  $(inst_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/c++98/Makefile.am b/libstdc++-v3/src/c++98/Makefile.am
index 63e52355367..284ffda3443 100644
--- a/libstdc++-v3/src/c++98/Makefile.am
+++ b/libstdc++-v3/src/c++98/Makefile.am
@@ -148,7 +148,11 @@ sources = \
 
 vpath % $(top_srcdir)/src/c++98
 
+if GLIBCXX_HOSTED
 libc__98convenience_la_SOURCES = $(sources)
+else
+libc__98convenience_la_SOURCES =
+endif
 
 # Use special rules to compile with -fimplicit-templates.
 c++locale.lo: c++locale.cc
diff --git a/libstdc++-v3/src/c++98/Makefile.in b/libstdc++-v3/src/c++98/Makefile.in
index bd63782a12d..a100df77a6d 100644
--- a/libstdc++-v3/src/c++98/Makefile.in
+++ b/libstdc++-v3/src/c++98/Makefile.in
@@ -144,7 +144,8 @@ am__objects_7 = bitmap_allocator.lo pool_allocator.lo mt_allocator.lo \
 	stdexcept.lo strstream.lo tree.lo istream.lo istream-string.lo \
 	streambuf.lo valarray.lo $(am__objects_1) $(am__objects_3) \
 	$(am__objects_6)
-am_libc__98convenience_la_OBJECTS = $(am__objects_7)
+@GLIBCXX_HOSTED_TRUE@am_libc__98convenience_la_OBJECTS =  \
+@GLIBCXX_HOSTED_TRUE@	$(am__objects_7)
 libc__98convenience_la_OBJECTS = $(am_libc__98convenience_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -521,7 +522,8 @@ sources = \
 	${host_sources} \
 	${host_sources_extra}
 
-libc__98convenience_la_SOURCES = $(sources)
+@GLIBCXX_HOSTED_FALSE@libc__98convenience_la_SOURCES = 
+@GLIBCXX_HOSTED_TRUE@libc__98convenience_la_SOURCES = $(sources)
 @ENABLE_DUAL_ABI_TRUE@GLIBCXX_ABI_FLAGS = -D_GLIBCXX_USE_CXX11_ABI=@glibcxx_cxx98_abi@
 
 # Use special rules for the deprecated source files so that they find

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-06 14:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 14:24 [gcc r13-5713] libstdc++: Enable building libstdc++.{a, so} when !HOSTED Jonathan Wakely

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).