Patchwork missing libstdc++.6 symbol on the trunk

login
register
mail settings
Submitter Jonathan Wakely
Date Dec. 2, 2010, 10:18 p.m.
Message ID <AANLkTimtP0DEKNno_SuTMu=MV4gK=vnbmna8K_U23+52@mail.gmail.com>
Download mbox | patch
Permalink /patch/74033/
State New
Headers show

Comments

Jonathan Wakely - Dec. 2, 2010, 10:18 p.m.
On 2 December 2010 12:55, Paolo Carlini wrote:
> On 12/02/2010 01:53 PM, Jonathan Wakely wrote:
>> http://gcc.gnu.org/viewcvs?view=revision&revision=166171
>> N3092 changed the definition of future_category, but IIRC I had
>> intentionally not changed our version because of the ABI implications.
>>  We should probably do a backwards-compatibility fix so that
>> _ZSt15future_category is still exported with the correct symver.
>>
> Right, I just came to the same conclusion (and I don't see why the new
> symbol can't just be versioned @GLIBCXX_3.4.15). Are you willing to work
> on it?

Seems to be fixed by the attached patch, but I'd appreciate a review
from someone who understands the .symver directive better than me.

I used the @@@ form of .symver so that the symbol is renamed.  With
the @ or @@ forms the missing std::future_category symbol gets
exported, but it's a null pointer so programs using it can link but
crash if they dereference the pointer.  With @@@ we get the desired
behaviour and no crash (at least in my brief tests.)

        * src/future.cc (future_category): Export compatibility symbol.
        * config/abi/pre/gnu.ver: Move _ZSt15future_categoryv to 3.4.15
        version.

Tested x86_64-linux, committed to trunk.

Patch

Index: src/future.cc
===================================================================
--- src/future.cc	(revision 167318)
+++ src/future.cc	(working copy)
@@ -75,3 +75,23 @@  _GLIBCXX_BEGIN_NAMESPACE(std)
   future_error::what() const throw() { return _M_code.message().c_str(); }
 
 _GLIBCXX_END_NAMESPACE
+
+// XXX GLIBCXX_ABI Deprecated
+// gcc-4.6.0
+// <future> export changes
+#if defined(_GLIBCXX_SYMVER_GNU) && defined(PIC) \
+    && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
+    && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
+
+namespace __gnu_cxx
+{
+  const std::error_category* future_category = &__future_category_instance();
+}
+
+#define _GLIBCXX_ASM_SYMVER(cur, old, version) \
+   asm (".symver " #cur "," #old "@@@" #version);
+
+_GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx15future_categoryE, _ZSt15future_category, GLIBCXX_3.4.14)
+
+#endif
+
Index: config/abi/pre/gnu.ver
===================================================================
--- config/abi/pre/gnu.ver	(revision 167318)
+++ config/abi/pre/gnu.ver	(working copy)
@@ -1107,7 +1107,6 @@  GLIBCXX_3.4.14 {
     _ZNSt9__atomic011atomic_flag5clearESt12memory_order;
 
     # future
-    _ZSt15future_category;
     _ZNSt12future_errorD*;
     _ZNKSt12future_error4whatEv;
     _ZTSSt12future_error;
@@ -1115,6 +1114,9 @@  GLIBCXX_3.4.14 {
     _ZTISt12future_error;
     _ZSt20__throw_future_errori;
 
+    # GLIBCXX_ABI compatibility only.
+    _ZSt15future_category;
+
     # string|wstring ::cbegin member functions
     _ZNKSs6cbeginEv;
     _ZNKSs4cendEv;
@@ -1191,14 +1193,10 @@  GLIBCXX_3.4.15 {
     __emutls_v._ZSt11__once_call;
     __emutls_v._ZSt15__once_callable;
 
-} GLIBCXX_3.4.14;
-
-GLIBCXX_3.4.16 {
-
     # std::future_category is now a function
     _ZSt15future_categoryv;
 
-} GLIBCXX_3.4.15;
+} GLIBCXX_3.4.14;
 
 # Symbols in the support library (libsupc++) have their own tag.
 CXXABI_1.3 {