Bug 52189 - [4.7 regression] Relaxed gthreads check breaks Solaris 8/9 symbol versioning
Summary: [4.7 regression] Relaxed gthreads check breaks Solaris 8/9 symbol versioning
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Rainer Orth
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords: ABI
Depends on:
Blocks:
 
Reported: 2012-02-09 18:43 UTC by Rainer Orth
Modified: 2012-02-17 13:45 UTC (History)
0 users

See Also:
Host: *-*-solaris2.[89]
Target: *-*-solaris2.[89]
Build: *-*-solaris2.[89]
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2012-02-09 18:43:20 UTC
As already discussed in

  http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01163.html

the relaxed gthreads check in 4.7 breaks libstdc++ symbol versioning on
Solaris 8 and 9 by exposing a considerable set of thread-dependent symbols
at the closed version GLIBCXX_3.4.11.

I think there are several options to fix this:

* Default to --disable-threads on Solaris 8/9 to avoid breaking symbol
  versioning.  That's my current preference, but certainly requires documentation
  explaining the choice, since it's obviously a pity.

* Export them at GLIBCXX_3.4.17 instead *on Solaris*.  This has the serious
  disadvantage that such a Solaris 8/9 binary cannot run on Solaris 10+
  which has those symbols at 3.4.11, and Solaris ld.so.1 doesn't support
  the symbol renaming/aliasing to also export them at 3.4.17, too, even if gld
  is in use.

* Do nothing and let the breakage happen ;-(

  Rainer
Comment 1 Richard Biener 2012-02-10 11:20:33 UTC
4) Don't export them (thus, eventually live with undefined symbols?)
Comment 2 Jonathan Wakely 2012-02-10 11:25:35 UTC
This change:

--- baseline_symbols.txt        2012-01-23 19:01:03.590486000 +0100
+++ baseline_symbols.txt.s8g    2012-01-23 19:03:38.063402000 +0100
@@ -2176,0 +2177 @@
+FUNC:_ZSt16__get_once_mutexv@@GLIBCXX_3.4.12
@@ -2209,0 +2211 @@
+FUNC:_ZSt23__get_once_functor_lockv@@GLIBCXX_3.4.11
@@ -2212,0 +2215 @@
+FUNC:_ZSt27__set_once_functor_lock_ptrPSt11unique_lockISt5mutexE@@GLIBCXX_3.4.12
@@ -2649,0 +2653 @@
+OBJECT:16:_ZSt14__once_functor@@GLIBCXX_3.4.11
@@ -2715,2 +2718,0 @@
-OBJECT:16:__emutls_v._ZSt11__once_call@@GLIBCXX_3.4.15
-OBJECT:16:__emutls_v._ZSt15__once_callable@@GLIBCXX_3.4.15

indicates that it was previously using TLS and now isn't (as discussed in PR 52104) so that's what should be fixed to bring the __once_call* symbols back
Comment 3 Jonathan Wakely 2012-02-10 11:29:09 UTC
(In reply to comment #0)
> * Default to --disable-threads on Solaris 8/9 to avoid breaking symbol
>   versioning.  That's my current preference, but certainly requires
> documentation
>   explaining the choice, since it's obviously a pity.

Or override the autoconf check which decides to enable C++11 thread support, which would only disable std::thread, std::future etc. (the source of the problem symbols) rather than disabling all thread support.
Comment 4 Jonathan Wakely 2012-02-10 11:31:22 UTC
i.e #undef _GLIBCXX_HAS_GTHREADS
Comment 5 ro@CeBiTec.Uni-Bielefeld.DE 2012-02-16 20:02:08 UTC
> --- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-10 11:20:33 UTC ---
> 4) Don't export them (thus, eventually live with undefined symbols?)

Right, that's what my patch does, with the options for users to override
that if they don't care about compatiblity.

	Rainer
Comment 6 ro@CeBiTec.Uni-Bielefeld.DE 2012-02-16 20:04:42 UTC
> --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-10 11:25:35 UTC ---
> This change:
>
> --- baseline_symbols.txt        2012-01-23 19:01:03.590486000 +0100
> +++ baseline_symbols.txt.s8g    2012-01-23 19:03:38.063402000 +0100
> @@ -2176,0 +2177 @@
> +FUNC:_ZSt16__get_once_mutexv@@GLIBCXX_3.4.12
> @@ -2209,0 +2211 @@
> +FUNC:_ZSt23__get_once_functor_lockv@@GLIBCXX_3.4.11
> @@ -2212,0 +2215 @@
> +FUNC:_ZSt27__set_once_functor_lock_ptrPSt11unique_lockISt5mutexE@@GLIBCXX_3.4.12
> @@ -2649,0 +2653 @@
> +OBJECT:16:_ZSt14__once_functor@@GLIBCXX_3.4.11
> @@ -2715,2 +2718,0 @@
> -OBJECT:16:__emutls_v._ZSt11__once_call@@GLIBCXX_3.4.15
> -OBJECT:16:__emutls_v._ZSt15__once_callable@@GLIBCXX_3.4.15
>
> indicates that it was previously using TLS and now isn't (as discussed in PR
> 52104) so that's what should be fixed to bring the __once_call* symbols back

It's rather the other way round: baseline_symbols.txt (i.e. native tools
where as lacks TLS support) is with emutls, while
baseline_symbols.txt.s8g uses gas/ld (or gas/gld) with native TLS.  What
put me off at first was that both symbols were removed and added, but
Jakub already provided the solution: omit the emutls symbols in the
installed baseline.txt, so both emutls and native TLS only adds to the
baseline.

	Rainer
Comment 7 ro@CeBiTec.Uni-Bielefeld.DE 2012-02-16 20:05:27 UTC
> --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-10 11:29:09 UTC ---
> (In reply to comment #0)
>> * Default to --disable-threads on Solaris 8/9 to avoid breaking symbol
>>   versioning.  That's my current preference, but certainly requires
>> documentation
>>   explaining the choice, since it's obviously a pity.
>
> Or override the autoconf check which decides to enable C++11 thread support,
> which would only disable std::thread, std::future etc. (the source of the
> problem symbols) rather than disabling all thread support.

That's what my patch does.

Thanks.
        Rainer
Comment 8 Rainer Orth 2012-02-17 13:38:22 UTC
Author: ro
Date: Fri Feb 17 13:38:15 2012
New Revision: 184335

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184335
Log:
Disable gthreads on Solaris 8/9 (PR libstdc++/52189)

	PR libstdc++/52189
	* acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Handle
	--enable-libstdcxx-threads.
	Disable on Solaris 8/9 with symbol versioning.
	* configure.ac (GLIBCXX_CHECK_GTHREADS): Move after
	GLIBCXX_ENABLE_SYMVERS.
	* configure: Regenerate.
	* doc/xml/manual/configure.xml (--enable-libstdcxx-threads): Explain.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/acinclude.m4
    trunk/libstdc++-v3/configure
    trunk/libstdc++-v3/configure.ac
    trunk/libstdc++-v3/doc/xml/manual/configure.xml
Comment 9 Rainer Orth 2012-02-17 13:45:01 UTC
Fixed for 4.7.0.