]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Stop defining C++0x compat symbols for versioned namespace
authorJonathan Wakely <jwakely@redhat.com>
Mon, 16 May 2022 15:54:52 +0000 (16:54 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 17 May 2022 10:42:34 +0000 (11:42 +0100)
The src/c++11/compatibility*-c++0x.cc files define symbols that need to
be exported for ancient versions of libstdc++.so.6 due to changes
between C++0x and the final C++11 standard. Those symbols are not needed
in the libstdc++.so.8 library, and we can skip building them entirely.

This also fixes the build failure I introduced last week when making the
versioned namespace config not use the _V2 namespace for compat symbols.

libstdc++-v3/ChangeLog:

* src/Makefile.am [ENABLE_SYMVERS_GNU_NAMESPACE] (cxx11_sources):
Do not build the compatibility*-c++0x.cc objects.
* src/Makefile.in: Regenerate.
* src/c++11/compatibility-c++0x.cc [_GLIBCXX_INLINE_VERSION]:
Refuse to build for the versioned namespace.
* src/c++11/compatibility-chrono.cc: Likewise.
* src/c++11/compatibility-condvar.cc: Likewise.
* src/c++11/compatibility-thread-c++0x.cc: Likewise.
* src/c++11/chrono.cc (system_clock, steady_clock):
Use macros to define in inline namespace _V2, matching the
declarations in <system_error>.
* src/c++11/system_error.cc (system_category, generic_category):
Likewise.

libstdc++-v3/src/Makefile.am
libstdc++-v3/src/Makefile.in
libstdc++-v3/src/c++11/chrono.cc
libstdc++-v3/src/c++11/compatibility-c++0x.cc
libstdc++-v3/src/c++11/compatibility-chrono.cc
libstdc++-v3/src/c++11/compatibility-condvar.cc
libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
libstdc++-v3/src/c++11/system_error.cc

index 9c3f4aca65584664bdaa3774189f766af59de133..b83c222d51d13cd409d24ace8e60666de9ac69d1 100644 (file)
@@ -96,6 +96,16 @@ else
 ldbl_alt128_compat_sources =
 endif
 
+if ENABLE_SYMVERS_GNU_NAMESPACE
+cxx0x_compat_sources =
+else
+cxx0x_compat_sources = \
+       compatibility-atomic-c++0x.cc \
+       compatibility-c++0x.cc \
+       compatibility-chrono.cc \
+       compatibility-condvar.cc \
+       compatibility-thread-c++0x.cc
+endif
 
 parallel_compat_sources = \
        compatibility-parallel_list.cc  compatibility-parallel_list-2.cc
@@ -108,11 +118,7 @@ cxx98_sources = \
        ${ldbl_compat_sources}
 
 cxx11_sources = \
-       compatibility-c++0x.cc \
-       compatibility-atomic-c++0x.cc \
-       compatibility-thread-c++0x.cc \
-       compatibility-chrono.cc \
-       compatibility-condvar.cc \
+       ${cxx0x_compat_sources} \
        ${ldbl_alt128_compat_sources}
 
 libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources)
index 4a06f6cfec18c6a91d93a48a595c8ec88489b97c..cef290c5d111bf5fa4f73b2b30f4f57cae86786b 100644 (file)
@@ -153,14 +153,17 @@ am__DEPENDENCIES_1 =
 @GLIBCXX_LDBL_COMPAT_TRUE@am__objects_1 = compatibility-ldbl.lo
 am__objects_2 = compatibility.lo compatibility-debug_list.lo \
        compatibility-debug_list-2.lo $(am__objects_1)
-@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@am__objects_3 = compatibility-ldbl-alt128-cxx11.lo
-@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@am__objects_4 =  \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@am__objects_3 = compatibility-atomic-c++0x.lo \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-c++0x.lo \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-chrono.lo \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-condvar.lo \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-thread-c++0x.lo
+@ENABLE_DUAL_ABI_TRUE@@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@am__objects_4 = compatibility-ldbl-alt128-cxx11.lo
+@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@am__objects_5 =  \
 @GLIBCXX_LDBL_ALT128_COMPAT_TRUE@      compatibility-ldbl-alt128.lo \
-@GLIBCXX_LDBL_ALT128_COMPAT_TRUE@      $(am__objects_3)
-am__objects_5 = compatibility-c++0x.lo compatibility-atomic-c++0x.lo \
-       compatibility-thread-c++0x.lo compatibility-chrono.lo \
-       compatibility-condvar.lo $(am__objects_4)
-am_libstdc___la_OBJECTS = $(am__objects_2) $(am__objects_5)
+@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)
 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)
@@ -512,6 +515,14 @@ SUBDIRS = c++98 c++11 c++17 c++20 $(filesystem_dir) $(backtrace_dir)
 @GLIBCXX_LDBL_ALT128_COMPAT_TRUE@      compatibility-ldbl-alt128.cc \
 @GLIBCXX_LDBL_ALT128_COMPAT_TRUE@      ${ldbl_alt128_compat_cxx11_sources}
 
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@cxx0x_compat_sources = \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-atomic-c++0x.cc \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-c++0x.cc \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-chrono.cc \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-condvar.cc \
+@ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@   compatibility-thread-c++0x.cc
+
+@ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@cxx0x_compat_sources = 
 parallel_compat_sources = \
        compatibility-parallel_list.cc  compatibility-parallel_list-2.cc
 
@@ -522,11 +533,7 @@ cxx98_sources = \
        ${ldbl_compat_sources}
 
 cxx11_sources = \
-       compatibility-c++0x.cc \
-       compatibility-atomic-c++0x.cc \
-       compatibility-thread-c++0x.cc \
-       compatibility-chrono.cc \
-       compatibility-condvar.cc \
+       ${cxx0x_compat_sources} \
        ${ldbl_alt128_compat_sources}
 
 libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources)
index 6825b5bc4bf032ee298e868bb9b899dab1951d67..5539d8cbedd110cd053950e86a1a4c18d4bfcf9f 100644 (file)
@@ -43,8 +43,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   namespace chrono
   {
-    // XXX GLIBCXX_ABI Deprecated
-    inline namespace _V2 {
+_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
 
     constexpr bool system_clock::is_steady;
 
@@ -94,7 +93,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
     }
 
-  } // end inline namespace _V2
+_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
   } // namespace chrono
 
 _GLIBCXX_END_NAMESPACE_VERSION
index d48f5bd1e280c1ec4d0a1cf22a3bd846c3136ae9..768dd666d00b272fd968a5e391a5fde33a0bbb2a 100644 (file)
 # error "compatibility-c++0x.cc must be compiled with -std=gnu++0x"
 #endif
 
+#if _GLIBCXX_INLINE_VERSION
+# error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace"
+#endif
+
 #ifdef _GLIBCXX_SHARED
 
 namespace std _GLIBCXX_VISIBILITY(default)
index 38b96e811fb2ed616624c7df659ef798674159b2..6beb8b39a2502e3043ee59164ab16f80ba1d1f50 100644 (file)
 
 #include <bits/c++config.h>
 
+#if _GLIBCXX_INLINE_VERSION
+# error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace"
+#endif
+
 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
 
 #ifdef _GLIBCXX_USE_GETTIMEOFDAY
index ea3e11efeda037c7f0387eec4decd808db568561..e3a8b8403ca48f702984089e70b1999513fa6c9b 100644 (file)
 # error "compatibility-condvar-c++0x.cc must be compiled with -std=gnu++11"
 #endif
 
+#if _GLIBCXX_INLINE_VERSION
+# error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace"
+#endif
+
 #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
 
 #define condition_variable_any condition_variable_anyXX
index dbacda2bc449938d8cab59996db84807f56a18b3..d920f9f034552103ab594307737534a5d2e9ed2f 100644 (file)
 # error "compatibility-thread-c++0x.cc must be compiled with -std=gnu++0x"
 #endif
 
+#if _GLIBCXX_INLINE_VERSION
+# error "compatibility-thread-c++0x.cc is not needed for gnu-versioned-namespace"
+#endif
+
 #define _GLIBCXX_ASM_SYMVER(cur, old, version) \
    asm (".symver " #cur "," #old "@@@" #version);
 
index 7b1a5a20637def5cb95e151c099fca9c0f2f8caf..8c13642408de05638830608f99854bdf3bdfe146 100644 (file)
@@ -526,11 +526,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   error_category::~error_category() = default;
 
+_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
+
   const error_category&
-  _V2::system_category() noexcept { return system_category_instance.obj; }
+  system_category() noexcept { return system_category_instance.obj; }
 
   const error_category&
-  _V2::generic_category() noexcept { return generic_category_instance.obj; }
+  generic_category() noexcept { return generic_category_instance.obj; }
+
+_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 
   system_error::~system_error() = default;