This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: [PATCH] Export explicit instantiations for C++17 members of std::string


Hi Jonathan,

> The C++17 standard added some new members to std::basic_string, which
> were not previously instantiated in the library. This meant that the
> extern template declarations had to be disabled for C++17 mode. With
> this patch the new members are instantiated in the library and so the
> explicit instantiation declarations can be used for C++17.
>
> The new members added by C++2a are still not exported, and so the
> explicit instantiation declarations are still disabled for C++2a.
>
> 	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Make patterns less greedy
> 	for const member functions of std::basic_string.
> 	(GLIBCXX_3.4.26): Export member functions of std::basic_string added
> 	in C++17.
> 	* include/bits/basic_string.h (basic_string(__sv_wrapper, const A&)):
> 	Make non-standard constructor private.
> 	[!_GLIBCXX_USE_CXX11_ABI] (basic_string(__sv_wrapper, const A&)):
> 	Likewise.
> 	* include/bits/basic_string.tcc (std::string, std::wstring): Declare
> 	explicit instantiations for C++17 as well as earlier dialects.
> 	* src/c++17/Makefile.am: Add new source files.
> 	* src/c++17/Makefile.in: Regenerate.
> 	* src/c++17/cow-string-inst.cc: New file defining explicit
> 	instantiations for basic_string member functions added in C++17.
> 	* src/c++17/string-inst.cc: Likewise.
>
> Tested powerpc64le-linux, committed to trunk.

this patch broke Solaris bootstrap:

ld: fatal: libstdc++-symbols.ver-sun: 6705: symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator std::basic_string_view<char, std::char_traits<char> >() const': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6707: symbol 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator std::basic_string_view<wchar_t, std::char_traits<wchar_t> >() const': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6712: symbol 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::data()': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6714: symbol 'std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::data()': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6723: symbol 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_to_string_view(std::basic_string_view<char, std::char_traits<char> >)': symbol version conflict
ld: fatal: libstdc++-symbols.ver-sun: 6724: symbol 'std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_S_to_string_view(std::basic_string_view<wchar_t, std::char_traits<wchar_t> >)': symbol version conflict
collect2: error: ld returned 1 exit status
make[6]: *** [Makefile:696: libstdc++.la] Error 1

Rerunning with COLLECT_NO_DEMANGLE=1 gives (with symbol versions and
patterns matched extracted from libstdc++-symbols.ver-sun):

d: fatal: libstdc++-symbols.ver-sun: 6705: symbol '_ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv': symbol version conflict

  GLIBCXX_3.4
    ##_ZNKSs[a-z]* (glob)
    _ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv;
  GLIBCXX_3.4.26
    ##_ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv (glob)
    _ZNKSscvSt17basic_string_viewIcSt11char_traitsIcEEEv;

ld: fatal: libstdc++-symbols.ver-sun: 6707: symbol '_ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv': symbol version conflict

  GLIBCXX_3.4
    ##_ZNKSbIwSt11char_traitsIwESaIwEE[a-z]* (glob)    
    _ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv;
  GLIBCXX_3.4.26
    ##_ZNKSbIwSt11char_traitsIwESaIwEE[a-z]* (glob)
    _ZNKSbIwSt11char_traitsIwESaIwEEcvSt17basic_string_viewIwS0_EEv;

ld: fatal: libstdc++-symbols.ver-sun: 6712: symbol '_ZNSs4dataEv': symbol version conflict

  GLIBCXX_3.4
    ##_ZNSs[0-58-9][c-e]* (glob)    
    _ZNSs4dataEv;
  GLIBCXX_3.4.26
    ##_ZNSs4dataEv (glob)
    _ZNSs4dataEv;

ld: fatal: libstdc++-symbols.ver-sun: 6714: symbol '_ZNSbIwSt11char_traitsIwESaIwEE4dataEv': symbol version conflict

  GLIBCXX_3.4
    ##_ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][c-e]* (glob)
    _ZNSbIwSt11char_traitsIwESaIwEE4dataEv;
  GLIBCXX_3.4.26
    ##_ZNSbIwSt11char_traitsIwESaIwEE4dataEv (glob)
    _ZNSbIwSt11char_traitsIwESaIwEE4dataEv;

ld: fatal: libstdc++-symbols.ver-sun: 6723: symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17_S_to_string_viewESt17basic_string_viewIcS2_E': symbol version conflict

  GLIBCXX_3.4.21
    ##_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]* (glob)
    _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17_S_to_string_viewESt17basic_string_viewIcS2_E;
  GLIBCXX_3.4.26
    ##_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE17_S_to_string_viewESt17basic_string_viewI[cw]S2_E (glob)
    _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE17_S_to_string_viewESt17basic_string_viewIcS2_E;

ld: fatal: libstdc++-symbols.ver-sun: 6724: symbol '_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE17_S_to_string_viewESt17basic_string_viewIwS2_E': symbol version conflict

  GLIBCXX_3.4.21
    ##_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]* (glob)
    _ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE17_S_to_string_viewESt17basic_string_viewIwS2_E;
  GLIBCXX_3.4.26
    ##_ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE17_S_to_string_viewESt17basic_string_viewI[cw]S2_E (glob)
    _ZNSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE17_S_to_string_viewESt17basic_string_viewIwS2_E;

The following patch allowed the build to finish.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -217,7 +217,7 @@ GLIBCXX_3.4 {
     _ZNSsD*;
     _ZNSs[0-58-9]a*;
     _ZNSs5beginEv;
-    _ZNSs[0-58-9][c-e]*;
+    _ZNSs[0-358-9][c-e]*;
     _ZNSs[0-59][g-z]*;
 #   _ZNSs[67][a-z]*E[PRcjmvy]*;
     _ZNSs6appendE[PRcjmvy]*;
@@ -258,7 +258,7 @@ GLIBCXX_3.4 {
     _ZNKSs[0-9][g-z]*;
     _ZNKSs[0-9][0-9][a-z]*;
     _ZNKSs4find*;
-    _ZNKSs[a-z]*;
+    _ZNKSs[abd-z]*;
     _ZNKSs4_Rep12_M_is_leakedEv;
     _ZNKSs4_Rep12_M_is_sharedEv;
     _ZNKSs6_M_repEv;
@@ -284,7 +284,7 @@ GLIBCXX_3.4 {
     _ZNSbIwSt11char_traitsIwESaIwEED*;
     _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9]a*;
     _ZNSbIwSt11char_traitsIwESaIwEE5beginEv;
-    _ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][c-e]*;
+    _ZNSbIwSt11char_traitsIwESaIwEE[0-358-9][c-e]*;
     _ZNSbIwSt11char_traitsIwESaIwEE[0-59][g-z]*;
 #   _ZNSbIwSt11char_traitsIwESaIwEE[67][a-b]*E[PRwjmvy]*;
     _ZNSbIwSt11char_traitsIwESaIwEE6appendE[PRwjmvy]*;
@@ -324,7 +324,7 @@ GLIBCXX_3.4 {
     _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][d-e]*;
     _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][g-z]*;
     _ZNKSbIwSt11char_traitsIwESaIwEE[0-9][0-9][a-z]*;
-    _ZNKSbIwSt11char_traitsIwESaIwEE[a-z]*;
+    _ZNKSbIwSt11char_traitsIwESaIwEE[abd-z]*;
     _ZNKSbIwSt11char_traitsIwESaIwEE4find*;
     _ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_leakedEv;
     _ZNKSbIwSt11char_traitsIwESaIwEE4_Rep12_M_is_sharedEv;
@@ -1702,7 +1702,7 @@ GLIBCXX_3.4.21 {
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE12_M*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE13*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE14_M_replace_aux*;
-    _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[5-9]*;
+    _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE1[568-9]*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE2at*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE3end*;
     _ZNSt7__cxx1112basic_stringI[cw]St11char_traitsI[cw]ESaI[cw]EE4back*;

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