This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] versioned-namespaces spelling/soname change


As noticed by Jonathan, the namespace chosen for this extension is not
in the implementation namespace and clashes with a similar name in
<functional>: the placeholders for bind.

Fixed thusly. And another name injection patchlet.

However, there's a bit of an added wrinkle in that now libstdc++ is
linked in earlier in the build, and is not just this target library.
So, to avoid confusion and build errors, 

--enable-symvers=gnu-versioned-namespace

Now sets libstdc++.so's SONAME to libstdc++.so.7, not
libstdc++.so.6.x.x. Ie, incompatible. 

This is not really a huge conceptual change. This flag was always about
creating a new ABI for libstdc++ and has clearly been marked as
incompatible. Now, I've explicitly named it as such. Yay!

I'm going to let this chill a bit on mainline and then check in to
4.6.x.

-benjamin

tested x86/linux
tested x86/linux --enable-gnu-versioned-namespace
2011-09-26  Benjamin Kosnik  <bkoz@redhat.com
            Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR libstdc++/48698
	* acinclude.m4 (GLIBCXX_ENABLE_SYMVERS): Set libtool_VERSION here.
	* configure.ac: Move AC_SUBST of libtool_VERSION past call to
	GLIBCXX_ENABLE_SYMVERS.
	* configure: Regenerate.
	* include/bits/c++config: Use __7 as versioned namespace name.
	* config/abi/pre/gnu-versioned-namespace.ver: Change mangling as
	per above.
	* include/c_global/cwchar: Adjust nested namespaces.
	* testsuite/20_util/bind/48698.cc: Add test case.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Change line number.


diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index ccfb2ce..1b9d025 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3054,10 +3054,15 @@ dnl
 dnl Add version tags to symbols in shared library (or not), additionally
 dnl marking other symbols as private/local (or not).
 dnl
+dnl Sets libtool_VERSION, and determines shared library SONAME.
+dnl
+dnl  This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no.
+dnl
 dnl --enable-symvers=style adds a version script to the linker call when
 dnl       creating the shared library.  The choice of version script is
 dnl       controlled by 'style'.
 dnl --disable-symvers does not.
+dnl
 dnl  +  Usage:  GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
 dnl       Where DEFAULT is either 'yes' or 'no'.  Passing `yes' tries to
 dnl       choose a default style based on linker characteristics.  Passing
@@ -3194,7 +3199,10 @@ changequote([,])dnl
   fi
 fi
 
-# Everything parsed; figure out what file to use.
+# For libtool versioning info, format is CURRENT:REVISION:AGE
+libtool_VERSION=6:17:0
+
+# Everything parsed; figure out what files and settings to use.
 case $enable_symvers in
   no)
     SYMVER_FILE=config/abi/pre/none.ver
@@ -3205,6 +3213,7 @@ case $enable_symvers in
 	      [Define to use GNU versioning in the shared library.])
     ;;
   gnu-versioned-namespace)
+    libtool_VERSION=7:0:0
     SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver
     AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1,
 	      [Define to use GNU namespace versioning in the shared library.])
diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
index ab9380c..32bcf67 100644
--- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
+++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
@@ -20,23 +20,23 @@
 ## with this library; see the file COPYING3.  If not see
 ## <http://www.gnu.org/licenses/>.
 
-GLIBCXX_5.0 {
+GLIBCXX_7.0 {
 
   global:
 
     # Names inside the 'extern' block are demangled names.
     extern "C++"
     {
-      std::_6::*;
+      std::__7::*;
       std::*
     };
 
     # locale
-    _ZNSt2_69has_facetINS_*;
+    _ZNSt3__79has_facetINS_*;
 
     # hash 
-    _ZNSt8__detail2_612__prime_listE;
-    _ZNSt3tr18__detail2_612__prime_listE;
+    _ZNSt8__detail3__712__prime_listE;
+    _ZNSt3tr18__detail3__712__prime_listE;
 
     # thread/mutex/condition_variable/future
     __once_proxy;
@@ -73,41 +73,41 @@ GLIBCXX_5.0 {
     _ZTv0_n*;
 
     # std::__detail::_List_node_base
-    _ZNSt8__detail2_615_List_node_base7_M_hook*;
-    _ZNSt8__detail2_615_List_node_base9_M_unhookEv;
-    _ZNSt8__detail2_615_List_node_base10_M_reverseEv;
-    _ZNSt8__detail2_615_List_node_base11_M_transfer*;
-    _ZNSt8__detail2_615_List_node_base4swapER*;
+    _ZNSt8__detail3__715_List_node_base7_M_hook*;
+    _ZNSt8__detail3__715_List_node_base9_M_unhookEv;
+    _ZNSt8__detail3__715_List_node_base10_M_reverseEv;
+    _ZNSt8__detail3__715_List_node_base11_M_transfer*;
+    _ZNSt8__detail3__715_List_node_base4swapER*;
 
     # std::__convert_to_v
-    _ZNSt2_614__convert_to_v*;
+    _ZNSt3__714__convert_to_v*;
 
     # std::__copy_streambufs
-    _ZNSt2_617__copy_streambufsI*;
-    _ZNSt2_621__copy_streambufs_eofI*;
+    _ZNSt3__717__copy_streambufsI*;
+    _ZNSt3__721__copy_streambufs_eofI*;
 
     # __gnu_cxx::__atomic_add
     # __gnu_cxx::__exchange_and_add
-    _ZN9__gnu_cxx2_612__atomic_addEPV[il][il];
-    _ZN9__gnu_cxx2_618__exchange_and_addEPV[li][il];
+    _ZN9__gnu_cxx3__712__atomic_addEPV[il][il];
+    _ZN9__gnu_cxx3__718__exchange_and_addEPV[li][il];
 
     # __gnu_cxx::__pool
-    _ZN9__gnu_cxx2_66__poolILb[01]EE13_M_initializeEv;
-    _ZN9__gnu_cxx2_66__poolILb[01]EE16_M_reserve_blockE[jm][jm];
-    _ZN9__gnu_cxx2_66__poolILb[01]EE16_M_reclaim_blockEPc[jm];
-    _ZN9__gnu_cxx2_66__poolILb[01]EE10_M_destroyEv;
-    _ZN9__gnu_cxx2_66__poolILb1EE16_M_get_thread_idEv;
+    _ZN9__gnu_cxx3__76__poolILb[01]EE13_M_initializeEv;
+    _ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reserve_blockE[jm][jm];
+    _ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reclaim_blockEPc[jm];
+    _ZN9__gnu_cxx3__76__poolILb[01]EE10_M_destroyEv;
+    _ZN9__gnu_cxx3__76__poolILb1EE16_M_get_thread_idEv;
 
-    _ZN9__gnu_cxx2_617__pool_alloc_base9_M_refillE[jm];    
-    _ZN9__gnu_cxx2_617__pool_alloc_base16_M_get_free_listE[jm];
-    _ZN9__gnu_cxx2_617__pool_alloc_base12_M_get_mutexEv;
+    _ZN9__gnu_cxx3__717__pool_alloc_base9_M_refillE[jm];    
+    _ZN9__gnu_cxx3__717__pool_alloc_base16_M_get_free_listE[jm];
+    _ZN9__gnu_cxx3__717__pool_alloc_base12_M_get_mutexEv;
 
-    _ZN9__gnu_cxx2_69free_list6_M_getE[jm];
-    _ZN9__gnu_cxx2_69free_list8_M_clearEv;
+    _ZN9__gnu_cxx3__79free_list6_M_getE[jm];
+    _ZN9__gnu_cxx3__79free_list8_M_clearEv;
 
     # __gnu_cxx::stdio_sync_filebuf
-    _ZTVN9__gnu_cxx2_618stdio_sync_filebufI[cw]St2_611char_traitsI[cw]EEE;
-    _ZN9__gnu_cxx2_618stdio_sync_filebufI[cw]NSt2_611char_traitsI[cw]EEE[5-9]*;
+    _ZTVN9__gnu_cxx3__718stdio_sync_filebufI[cw]St3__711char_traitsI[cw]EEE;
+    _ZN9__gnu_cxx3__718stdio_sync_filebufI[cw]NSt3__711char_traitsI[cw]EEE[5-9]*;
 
     # debug mode
     _ZN11__gnu_debug19_Safe_sequence_base12_M_get_mutexEv;
@@ -212,7 +212,7 @@ CXXABI_2.0 {
     _ZSt15_Fnv_hash_bytesPKv*;
 
     # __gnu_cxx::_verbose_terminate_handler()
-    _ZN9__gnu_cxx2_627__verbose_terminate_handlerEv;
+    _ZN9__gnu_cxx3__727__verbose_terminate_handlerEv;
 
     # *_type_info classes, ctor and dtor
     _ZN10__cxxabiv117__array_type_info*;
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 8b528ba..eb2fe85 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -11,10 +11,6 @@ AC_CONFIG_HEADER(config.h)
 # exported.  Only used at the end of this file.
 ### am handles this now?  ORIGINAL_LD_FOR_MULTILIBS=$LD
 
-# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:17:0
-AC_SUBST(libtool_VERSION)
-
 # Find the rest of the source tree framework.
 AM_ENABLE_MULTILIB(, ..)
 
@@ -305,13 +301,13 @@ fi
 # Check for _Unwind_GetIPInfo.
 GCC_CHECK_UNWIND_GETIPINFO
 
-
 GCC_LINUX_FUTEX([AC_DEFINE(HAVE_LINUX_FUTEX, 1, [Define if futex syscall is available.])])
 
 GCC_HEADER_STDINT(include/gstdint.h)
 
-# This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no.
 GLIBCXX_ENABLE_SYMVERS([yes])
+AC_SUBST(libtool_VERSION)
+
 GLIBCXX_ENABLE_VISIBILITY([yes])
 
 ac_ldbl_compat=no
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index e8a2946..8c61de3 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -176,41 +176,42 @@ namespace std
 
 
 // Defined if inline namespaces are used for versioning.
-#define _GLIBCXX_INLINE_VERSION
+#define _GLIBCXX_INLINE_VERSION 
 
 // Inline namespace for symbol versioning.
 #if _GLIBCXX_INLINE_VERSION
+
 namespace std
 {
-  inline namespace _6 { }
+  inline namespace __7 { }
 
-  namespace rel_ops { inline namespace _6 { } }
+  namespace rel_ops { inline namespace __7 { } }
 
   namespace tr1
   {
-    inline namespace _6 { }
-    namespace placeholders { inline namespace _6 { } }
-    namespace regex_constants { inline namespace _6 { } }
-    namespace __detail { inline namespace _6 { } }
+    inline namespace __7 { }
+    namespace placeholders { inline namespace __7 { } }
+    namespace regex_constants { inline namespace __7 { } }
+    namespace __detail { inline namespace __7 { } }
   }
 
-  namespace decimal { inline namespace _6 { } }
+  namespace decimal { inline namespace __7 { } }
 
-  namespace chrono { inline namespace _6 { } }
-  namespace placeholders { inline namespace _6 { } }
-  namespace regex_constants { inline namespace _6 { } }
-  namespace this_thread { inline namespace _6 { } }
+  namespace chrono { inline namespace __7 { } }
+  namespace placeholders { inline namespace __7 { } }
+  namespace regex_constants { inline namespace __7 { } }
+  namespace this_thread { inline namespace __7 { } }
 
-  namespace __detail { inline namespace _6 { } }
-  namespace __regex { inline namespace _6 { } }
+  namespace __detail { inline namespace __7 { } }
+  namespace __regex { inline namespace __7 { } }
 }
 
 namespace __gnu_cxx
 {
-  inline namespace _6 { }
-  namespace __detail { inline namespace _6 { } }
+  inline namespace __7 { }
+  namespace __detail { inline namespace __7 { } }
 }
-# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace _6 {
+# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 {
 # define _GLIBCXX_END_NAMESPACE_VERSION }
 #else
 # define _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -227,7 +228,7 @@ namespace std
   namespace __cxx1998
   {
 #if _GLIBCXX_INLINE_VERSION
- inline namespace _6 { }
+ inline namespace __7 { }
 #endif
   }
 
diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar
index 5a33965..a2b1168 100644
--- a/libstdc++-v3/include/c_global/cwchar
+++ b/libstdc++-v3/include/c_global/cwchar
@@ -136,6 +136,8 @@ namespace std
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   using ::wint_t;
 
   using ::btowc;
@@ -207,8 +209,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
   using ::wcsstr;
   using ::wmemchr;
 
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
 #ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO
   inline wchar_t*
   wcschr(wchar_t* __p, wchar_t __c)
diff --git a/libstdc++-v3/testsuite/20_util/bind/48698.cc b/libstdc++-v3/testsuite/20_util/bind/48698.cc
new file mode 100644
index 0000000..a623735
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bind/48698.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// 20.7.11 Function template bind
+
+#include <functional>
+
+int f(int i);
+
+// Don't want placeholders to interfere with a possibly-versioned namespace.
+int g()
+{
+  std::bind(f, std::placeholders::_6);
+}
diff --git a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
index eb77fb4..ba515b7 100644
--- a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
+++ b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc
@@ -25,4 +25,4 @@
 
 #include <vector>
 
-// { dg-error "multiple inlined namespaces" "" { target *-*-* } 255 }
+// { dg-error "multiple inlined namespaces" "" { target *-*-* } 256 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]