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>
This commit is contained in:
Arsen Arsenović 2022-10-20 17:49:50 +02:00 committed by Jonathan Wakely
parent fb8e29a5fd
commit abdea44725
12 changed files with 77 additions and 28 deletions

View File

@ -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

View File

@ -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 =

View File

@ -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) \

View File

@ -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 \

View File

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

View File

@ -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/'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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