diff mbox

Implement move semantics for iostreams

Message ID 20140924221538.GY2669@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Sept. 24, 2014, 10:15 p.m. UTC
On 24/09/14 15:48 +0100, Jonathan Wakely wrote:
>On 24/09/14 16:38 +0200, Rainer Orth wrote:
>>Hi Jonathan,
>>
>>>On 23/09/14 15:58 +0200, Rainer Orth wrote:
>>>>This patch broke Solaris bootstrap with Sun ld: when linking
>>>>libstdc++.so, ld complains
>>>>
>>>>ld: fatal: libstdc++-symbols.ver-sun: 4520: symbol 'std::basic_ios<char,
>>>>std::char_traits<char> >::move(std::basic_ios<char,
>>>>std::char_traits<char> >&&)': symbol version conflict
>>>>
>>>>and many more.  In that case, I find that this symbols is matched by
>>>>both the GLIBCXX_3.4 and GLIBCXX_3.4.21 patterns:
>>>>
>>>>   GLIBCXX_3.4
>>>>   ##std::basic_i[g-r]* (cxx)
>>>>   _ZNSt9basic_iosIcSt11char_traitsIcEE4moveEOS2_;
>>>>
>>>>   GLIBCXX_3.4.21
>>>>   ##_ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE4moveE[OR]S2_ (glob)
>>>>   _ZNSt9basic_iosIcSt11char_traitsIcEE4moveEOS2_;
>>>
>>>Rainer, I think this patch should fix it, could you test it please?
>>
>>almost there: now I only get
>>
>>ld: fatal: libstdc++-symbols.ver-sun: 4622: symbol 'std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::basic_ostream(std::basic_iostream<wchar_t, std::char_traits<wchar_t> >&)': symbol version conflict
>>ld: fatal: libstdc++-symbols.ver-sun: 4623: symbol 'std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::basic_ostream(std::basic_iostream<wchar_t, std::char_traits<wchar_t> >&)': symbol version conflict
>>
>>from
>>
>> GLIBCXX_3.4:
>>
>>   ##_ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]E[RP]* (glob)
>>   _ZNSt13basic_ostreamIwSt11char_traitsIwEEC1ERSt14basic_iostreamIwS1_E;
>>   _ZNSt13basic_ostreamIwSt11char_traitsIwEEC2ERSt14basic_iostreamIwS1_E;
>>
>> GLIBCXX_3.4.21:
>>
>>   ##_ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]ERSt14basic_iostreamIwS1_E (glob)
>>   _ZNSt13basic_ostreamIwSt11char_traitsIwEEC1ERSt14basic_iostreamIwS1_E;
>>   _ZNSt13basic_ostreamIwSt11char_traitsIwEEC2ERSt14basic_iostreamIwS1_E;
>
>Doh, yes, this additional tweak should solve that:
>
>index f736240..95fc3c7 100644
>--- a/libstdc++-v3/config/abi/pre/gnu.ver
>+++ b/libstdc++-v3/config/abi/pre/gnu.ver
>@@ -460,7 +460,7 @@ GLIBCXX_3.4 {
>
>    # std::basic_ostream<wchar_t>
>    _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]Ev;
>-    _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]E[RP]*;
>+    _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]EP*;
>    _ZNSt13basic_ostreamIwSt11char_traitsIwEED*;
>    _ZNKSt13basic_ostreamIwSt11char_traitsIwEE[0-9][a-z]*;
>    _ZNSt13basic_ostreamIwSt11char_traitsIwEE3putEw;
>
>>The glob in the 3.4 version also matches
>>
>>   _ZNSt13basic_ostreamIwSt11char_traitsIwEEC1EPSt15basic_streambufIwS1_E;
>>   _ZNSt13basic_ostreamIwSt11char_traitsIwEEC2EPSt15basic_streambufIwS1_E;
>
>Yes, that's all it needs to match, so changing [RP] to just P should work.
>
>>>(I tried installing Solaris in a VM but couldn't get it to work, maybe
>>>I should use the VirtualBox image instead of trying qemu/kvm.)
>>
>>VirtualBox works for me in principle, but I often found bootstrapping
>>gcc inside some VM almost intolerably slow...  There's been some talk on
>>getting Solaris up and running in the compile farm.
>
>That would be very useful.
>
>Thanks for the quick testing and analysis.

I'm committing this, which has one additional change to the basic_ios
patterns, so it won't match basic_ios<>::operator bool() when I add
that back.

Tested x86_64-linux, committed to trunk.


I'm tempted to tidy up the GLIBCXX_3.4 patterns in the linker script
quite considerably, there's no point these kind of patterns in there:

      std::basic_o[g-r]*;
      std::basic_ostr[a-d]*;

They don't match anything today, and if we add new symbols that match
them we wouldn't want them to get the GLIBCXX_3.4 version anyway!

Comments

Marc Glisse Sept. 25, 2014, 5:11 a.m. UTC | #1
On Wed, 24 Sep 2014, Jonathan Wakely wrote:

> I'm tempted to tidy up the GLIBCXX_3.4 patterns in the linker script
> quite considerably,

Paolo has done something like that this summer (motivated by -O0 builds) 
and reverted it for a detail, but it could be a good starting point.
Jonathan Wakely Sept. 25, 2014, 8:57 a.m. UTC | #2
On 25/09/14 07:11 +0200, Marc Glisse wrote:
>On Wed, 24 Sep 2014, Jonathan Wakely wrote:
>
>>I'm tempted to tidy up the GLIBCXX_3.4 patterns in the linker script
>>quite considerably,
>
>Paolo has done something like that this summer (motivated by -O0 
>builds) and reverted it for a detail, but it could be a good starting 
>point.

Oh yes, https://gcc.gnu.org/r211355  - I forgot about that, thanks.
diff mbox

Patch

commit c9f582474ee89860ab4999c360b5cc32a936a104
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Sep 24 22:13:29 2014 +0000

    	* config/abi/pre/gnu.ver: Make GLIBCXX_3.4 patterns stricter so the
    	new GLIBCXX_3.4.21 symbols don't match them.
    
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 58c90d6..63985fd 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -39,10 +39,11 @@  GLIBCXX_3.4 {
       std::basic_[g-h]*;
       std::basic_i[a-e]*;
 #     std::basic_ifstream;
-      std::basic_i[g-r]*;
+#     std::basic_ios;
+#     std::basic_iostream;
       std::basic_istr[a-d]*;
 #     std::basic_istream;
-      std::basic_istr[f-z]*;
+#     std::basic_istringstream;
       std::basic_i[t-z]*;
       std::basic_[j-n]*;
       std::basic_o[a-e]*;
@@ -50,12 +51,12 @@  GLIBCXX_3.4 {
 #     std::basic_o[g-z]*;
       std::basic_o[g-r]*;
       std::basic_ostr[a-d]*;
-      std::basic_ostr[f-z]*;
+#     std::basic_ostringstream;
       std::basic_[p-r]*;
 #     std::basic_streambuf
 #     std::basic_string
 #     std::basic_stringbuf
-      std::basic_stringstream*;
+#     std::basic_stringstream;
       std::basic_[t-z]*;
       std::ba[t-z]*;
       std::b[b-z]*;
@@ -94,7 +95,7 @@  GLIBCXX_3.4 {
       std::i[p-r]*;
 #     std::istream
 #     std::istreambuf_iterator
-      std::istringstream*;
+#     std::istringstream*;
       std::istrstream*;
       std::i[t-z]*;
       std::[A-Zj-k]*;
@@ -306,12 +307,14 @@  GLIBCXX_3.4 {
     # std::basic_streambuf
     _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[CD]*;
     _ZNKSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9]*;
-    _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9][a-z][^t]*;
+    _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE4set[gp]*;
+    _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE4sync*;
+    _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[5-9][a-z][^t]*;
     _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[0-9][0-9][a-z][^t]*;
     _ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EEaSERKS2_;
 
     # std::basic_stringbuf
-    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC*;
+    _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[RS]*;
     _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EED[^2]*;
     _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][a-r]*;
     _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9]seek*;
@@ -325,12 +328,48 @@  GLIBCXX_3.4 {
     _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9]_M_[q-z]*;
     _ZNSt15basic_stringbufI[cw]St11char_traitsI[cw]ESaI[cw]EE[0-9][0-9]_M_[a-z]*;
 
-    # std::basic_iostream constructors, destructors
-    _ZNSdC*;
+    # std::basic_istringstream
+    _ZNSt19basic_istringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[RS]*;
+    _ZNSt19basic_istringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED*;
+    _ZNSt19basic_istringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3str*;
+    _ZNKSt19basic_istringstream*;
+
+    # std::basic_ostringstream
+    _ZNSt19basic_ostringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[RS]*;
+    _ZNSt19basic_ostringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED*;
+    _ZNSt19basic_ostringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3str*;
+    _ZNKSt19basic_ostringstream*;
+
+    # std::basic_stringstream
+    _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EEC[12]E[RS]*;
+    _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EED*;
+    _ZNSt18basic_stringstreamI[cw]St11char_traitsI[cw]ESaI[cw]EE3str*;
+    _ZNKSt18basic_stringstream*;
+
+    # std::basic_iostream constructors (except move), destructors
+    _ZNSdC[12]Ev;
+    _ZNSdC[12]EP*;
     _ZNSdD*;
+    _ZNSt14basic_iostreamIwSt11char_traitsIwEEC[12]Ev;
+    _ZNSt14basic_iostreamIwSt11char_traitsIwEEC[12]EP*;
+    _ZNSt14basic_iostreamIwSt11char_traitsIwEED*;
+
+    # std::basic_ios constructors, destructors
+    _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EEC*;
+    _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EED*;
+
+    # std::basic_ios members (except move, swap, set_rdbuf)
+    _ZNKSt9basic_iosI[cw]St11char_traitsI[cw]EEcvPvEv;
+    _ZNKSt9basic_iosI[cw]St11char_traitsI[cw]EEntEv*;
+    _ZNKSt9basic_iosI[cw]St11char_traitsI[cw]EE[0-9]*;
+    _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE1[015]*;
+    _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE3tie*;
+    _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE4fill*;
+    _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE4init*;
+    _ZNSt9basic_iosI[cw]St11char_traitsI[cw]EE[578][a-z]*;
 
     # std::basic_filebuf
-    _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EEC*;
+    _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EEC[12]Ev;
     _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EED*;
     _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE0*;
     _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE13*;
@@ -372,23 +411,34 @@  GLIBCXX_3.4 {
     _ZNKSt14basic_ofstreamI[cw]St11char_traitsI[cw]EE5rdbufEv;
 
     # std::basic_istream<char>
-    _ZNSiC*;
+    _ZNSiC[12]Ev;
+    _ZNSiC[12]EP*;
     _ZNSiD*;
-    _ZNKSi[0-9][a-z]*;
-    _ZNSi[0-9][a-h]*;
-    _ZNSi[0-9][j-z]*;
+    _ZNKSi6sentry*;
+    _ZNKSi6gcount*;
+    _ZNSi3get*;
+    _ZNSi4peek*;
+    _ZNSi4read*;
+    _ZNSi4sync*;
+    _ZNSi7getline*;
+    _ZNSi[5-9][j-z]*;
     # 'x' here and below matches 'long long' where it
     # is used for signed sizetypes on LLP64 platforms.
     _ZNSi6ignoreE[ilx][ilx];
     _ZNSirsE*[^g];
 
     # std::basic_istream<wchar_t>
-    _ZNSt13basic_istreamIwSt11char_traitsIwEEC*;
+    _ZNSt13basic_istreamIwSt11char_traitsIwEEC[12]Ev;
+    _ZNSt13basic_istreamIwSt11char_traitsIwEEC[12]EP*;
     _ZNSt13basic_istreamIwSt11char_traitsIwEED*;
     _ZNKSt13basic_istreamIwSt11char_traitsIwEE[0-9][a-z]*;
-    _ZNSt13basic_istreamIwSt11char_traitsIwEE[0-9][a-h]*;
-    _ZNSt13basic_istreamIwSt11char_traitsIwEE[0-9][j-z]*;
+    _ZNSt13basic_istreamIwSt11char_traitsIwEE3get*;
+    _ZNSt13basic_istreamIwSt11char_traitsIwEE4peek*;
+    _ZNSt13basic_istreamIwSt11char_traitsIwEE4read*;
+    _ZNSt13basic_istreamIwSt11char_traitsIwEE4sync*;
+    _ZNSt13basic_istreamIwSt11char_traitsIwEE[5-9][j-z]*;
     _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreE[ilx][ijlmx];
+    _ZNSt13basic_istreamIwSt11char_traitsIwEE7getline*;
     _ZNSt13basic_istreamIwSt11char_traitsIwEErsE*[^g];
 
     # std::istream operators and extractors
@@ -402,15 +452,18 @@  GLIBCXX_3.4 {
     _ZStrsIf[cw]St11char_traitsI[cw]EERSt13basic_istream*;
 
     # std::basic_ostream<char>
-    _ZNSoC*;
+    _ZNSoC[12]Ev;
+    _ZNSoC[12]EP*;
     _ZNSoD*;
     _ZNKSo6sentrycvbEv;
     _ZNSo8_M_writeEPKc[ilx];
-    _ZNSo[0-9][a-z]*;
+    _ZNSo3put*;
+    _ZNSo[5-9][a-z]*;
     _ZNSolsE*[^g];
 
     # std::basic_ostream<wchar_t>
-    _ZNSt13basic_ostreamIwSt11char_traitsIwEEC*;
+    _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]Ev;
+    _ZNSt13basic_ostreamIwSt11char_traitsIwEEC[12]EP*;
     _ZNSt13basic_ostreamIwSt11char_traitsIwEED*;
     _ZNKSt13basic_ostreamIwSt11char_traitsIwEE[0-9][a-z]*;
     _ZNSt13basic_ostreamIwSt11char_traitsIwEE3putEw;