public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "François Dumont" <frs.dumont@gmail.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>
Subject: Re: [committed 03/12] libstdc++: Add macros for the inline namespace std::_V2
Date: Mon, 16 May 2022 17:13:37 +0100	[thread overview]
Message-ID: <CACb0b4kqhHHozeXyQrO3oVBjN+2AC=8Wg_cPtU95b0=1wfzToQ@mail.gmail.com> (raw)
In-Reply-To: <65a5eb4c-8c9e-4bc6-846a-a06b1f6d5c1e@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

On Sat, 14 May 2022 at 16:36, François Dumont via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Versioned namespace does not compile after this patch. With this patch
> it compiles but does not link because of:
>
> /usr/bin/ld: /usr/bin/ld: DWARF error: can't find .debug_ranges section.
> ../src/c++11/.libs/libc++11convenience.a(chrono.o): in function
> `std::__8::chrono::system_clock::now()':
> chrono.cc:(.text._ZNSt3__86chrono12system_clock3nowEv+0x0): multiple
> definition of `std::__8::chrono::system_clock::now()'; /usr/bin/ld:
> DWARF error: can't find .debug_ranges section.
> .libs/compatibility-chrono.o:compatibility-chrono.cc:(.text._ZNSt3__86chrono12system_clock3nowEv+0x0):
> first defined here

Oops, I knew I'd forgotten to check something!

I think the attached patch would be better. This stops defining the
C++0x compat symbols for the versioned namespace. Those symbols only
exist for backwards compatibility with ancient versions of
libstdc++.so.6 (from GCC 4.6 and similar vintages). We don't need
those symbols in libstdc++.so.8 at all.

This fixes the versioned namespace build, I'm running the tests now.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 6160 bytes --]

commit db4b611a49421fb5619aefbdf892d62d6eee6e47
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon May 16 16:54:52 2022 +0100

    libstdc++: Stop defining C++0x compat symbols for versioned namespace
    
    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.

diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 9c3f4aca655..b83c222d51d 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -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)
diff --git a/libstdc++-v3/src/c++11/chrono.cc b/libstdc++-v3/src/c++11/chrono.cc
index 6825b5bc4bf..5539d8cbedd 100644
--- a/libstdc++-v3/src/c++11/chrono.cc
+++ b/libstdc++-v3/src/c++11/chrono.cc
@@ -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
diff --git a/libstdc++-v3/src/c++11/compatibility-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-c++0x.cc
index d48f5bd1e28..768dd666d00 100644
--- a/libstdc++-v3/src/c++11/compatibility-c++0x.cc
+++ b/libstdc++-v3/src/c++11/compatibility-c++0x.cc
@@ -40,6 +40,10 @@
 # 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)
diff --git a/libstdc++-v3/src/c++11/compatibility-chrono.cc b/libstdc++-v3/src/c++11/compatibility-chrono.cc
index 38b96e811fb..6beb8b39a25 100644
--- a/libstdc++-v3/src/c++11/compatibility-chrono.cc
+++ b/libstdc++-v3/src/c++11/compatibility-chrono.cc
@@ -24,6 +24,10 @@
 
 #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
diff --git a/libstdc++-v3/src/c++11/compatibility-condvar.cc b/libstdc++-v3/src/c++11/compatibility-condvar.cc
index ea3e11efeda..e3a8b8403ca 100644
--- a/libstdc++-v3/src/c++11/compatibility-condvar.cc
+++ b/libstdc++-v3/src/c++11/compatibility-condvar.cc
@@ -28,6 +28,10 @@
 # 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
diff --git a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
index dbacda2bc44..d920f9f0345 100644
--- a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
+++ b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
@@ -35,6 +35,10 @@
 # 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);
 
diff --git a/libstdc++-v3/src/c++11/system_error.cc b/libstdc++-v3/src/c++11/system_error.cc
index 7b1a5a20637..8c13642408d 100644
--- a/libstdc++-v3/src/c++11/system_error.cc
+++ b/libstdc++-v3/src/c++11/system_error.cc
@@ -526,11 +526,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   error_category::~error_category() = default;
 
-  const error_category&
-  _V2::system_category() noexcept { return system_category_instance.obj; }
+_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
 
   const error_category&
-  _V2::generic_category() noexcept { return generic_category_instance.obj; }
+  system_category() noexcept { return system_category_instance.obj; }
+
+  const error_category&
+  generic_category() noexcept { return generic_category_instance.obj; }
+
+_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 
   system_error::~system_error() = default;
 

  parent reply	other threads:[~2022-05-16 16:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 12:40 [committed 01/12] libstdc++: Disable Doxygen GROUP_NESTED_COMPOUNDS config option Jonathan Wakely
2022-05-13 12:40 ` [committed 02/12] libstdc++: Fix typo in doxygen @headerfile command Jonathan Wakely
2022-05-13 12:40 ` [committed 03/12] libstdc++: Add macros for the inline namespace std::_V2 Jonathan Wakely
2022-05-14 15:36   ` François Dumont
2022-05-16  4:27     ` François Dumont
2022-05-16 16:19       ` Jonathan Wakely
2022-05-16 17:04         ` François Dumont
2022-05-16 16:13     ` Jonathan Wakely [this message]
2022-05-16 16:59       ` François Dumont
2022-05-13 12:40 ` [committed 04/12] libstdc++: Improve doxygen docs for std::pointer_traits Jonathan Wakely
2022-05-13 12:40 ` [committed 05/12] libstdc++: Improve doxygen docs for <system_error> Jonathan Wakely
2022-05-13 12:40 ` [committed 06/12] libstdc++: Improve doxygen docs for <atomic> Jonathan Wakely
2022-05-13 12:40 ` [committed 07/12] libstdc++: Improve doxygen docs for <regex> Jonathan Wakely
2022-05-13 12:40 ` [committed 08/12] libstdc++: Improve doxygen docs for std::allocator Jonathan Wakely
2022-05-13 12:40 ` [committed 09/12] libstdc++: Improve doxygen docs for algorithms and more Jonathan Wakely
2022-05-13 12:40 ` [committed 10/12] libstdc++: Improve doxygen docs for <thread> and <future> Jonathan Wakely
2022-05-13 12:40 ` [committed 11/12] libstdc++: Improve doxygen docs for some of <memory> Jonathan Wakely
2022-05-13 12:40 ` [committed 12/12] libstdc++: Improve doxygen docs for <mutex> 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='CACb0b4kqhHHozeXyQrO3oVBjN+2AC=8Wg_cPtU95b0=1wfzToQ@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=frs.dumont@gmail.com \
    --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).