diff mbox

[v3] Disable gthreads on Solaris 8/9 (PR libstdc++/52189)

Message ID yddobt0uh3a.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Feb. 15, 2012, 5:44 p.m. UTC
As discussed the improved/relaxed test for gthreads support breaks
symbol versioning on Solaris 8 and 9.  The best solution seems to
disable it by default on those targets, allowing users to reenable it if
they don't care about compatibility.

The following patch does just that, disabling only if symbol versioning
is active, and warning if users choose to enable it nonetheless.

I had to move the GLIBCXX_CHECK_GTHREADS down in configure.ac, adding a
dependency in acinclude.m4 didnd't suffice.

Bootstrapped without regressions on {sparc-sun,i386-pc}-solaris2.{8, 9,
10, 11} and x86_64-unknown-linux-gnu, verifying that there's no change
on Linux/x86_64 and the gthr-related symbols are gone on Solaris 8 and 9
only.

Ok for mainline?

Btw., the ChangeLog lies at one point: I didn't include the
configure.html update since I lack the required tools.  I'd appreciate
it if some of the libstdc++ maintainers could handle this for me after
checking.

Thanks.
	Rainer


2012-02-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR libstdc++/52189
	* acinclude.m4 (GLIBCXX_CHECK_GTHREADS): Handle --enable-gthreads.
	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-gthreads): Explain.
	* doc/html/manual/configure.html: Regenerate.

Comments

Jonathan Wakely Feb. 16, 2012, 12:52 a.m. UTC | #1
On 15 February 2012 17:44, Rainer Orth wrote:
>
> Ok for mainline?

Yes, although I would prefer the config option to be
--enable-libstdcxx-gthreads or --enable-libstdcxx-threads, since I
prefer it to be clear that a config option relates just to libstdc++,
and this only seems to affect libstdc++ not other libs such as libobjc
which make use of gthreads.

> Btw., the ChangeLog lies at one point: I didn't include the
> configure.html update since I lack the required tools.  I'd appreciate
> it if some of the libstdc++ maintainers could handle this for me after
> checking.

Sure, I can do that.
Rainer Orth Feb. 16, 2012, 7:10 p.m. UTC | #2
Hi Jon,

> On 15 February 2012 17:44, Rainer Orth wrote:
>>
>> Ok for mainline?
>
> Yes, although I would prefer the config option to be
> --enable-libstdcxx-gthreads or --enable-libstdcxx-threads, since I

I'll go for the latter since the use of gthreads is just an
implementation detail.

> prefer it to be clear that a config option relates just to libstdc++,
> and this only seems to affect libstdc++ not other libs such as libobjc
> which make use of gthreads.

Agreed: I didn't really like the name anyway, since it didn't suggest
much to the user.  It might also be useful to improve the configure.xml
description.

>> Btw., the ChangeLog lies at one point: I didn't include the
>> configure.html update since I lack the required tools.  I'd appreciate
>> it if some of the libstdc++ maintainers could handle this for me after
>> checking.
>
> Sure, I can do that.

Great, thanks.

	Rainer
Jonathan Wakely Feb. 17, 2012, 12:35 a.m. UTC | #3
On 16 February 2012 19:10, Rainer Orth wrote:
>>> Btw., the ChangeLog lies at one point: I didn't include the
>>> configure.html update since I lack the required tools.  I'd appreciate
>>> it if some of the libstdc++ maintainers could handle this for me after
>>> checking.
>>
>> Sure, I can do that.
>
> Great, thanks.

For the HTML docs, just check in without that bit in the ChangeLog.
Regenerating the HTML changes almost every page because links between
sections get randomly-generated anchor names, so I'll just do an
update for doc/html/* once your change is checked in.

(I've considered assigning a name to every section and sub-section in
the docs so that the link anchors are fixed and repeatable and
regenerating the html doesn't produce a huge diff ... but it's a lot
of very tedious work so I haven't done it.)
diff mbox

Patch

# HG changeset patch
# Parent c03709f1705410424658e4ee6f0f714ab4bbf69a
Disable gthreads on Solaris 8/9 (PR libstdc++/52189)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3325,7 +3325,13 @@  dnl Check if gthread implementation defi
 dnl required by the c++0x thread library.  Conforming gthread
 dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
 dnl
+dnl GLIBCXX_ENABLE_SYMVERS must be done before this.
+dnl
 AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
+  GLIBCXX_ENABLE(gthreads,auto,,[enable gthreads support])
+
+  if test x$enable_gthreads = xauto || test x$enable_gthreads = xyes; then
+
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
 
@@ -3364,7 +3370,28 @@  AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
       #ifndef __GTHREADS_CXX0X
       #error
       #endif
-    ], [ac_has_gthreads=yes], [ac_has_gthreads=no])
+    ], [case $target_os in
+	  # gthreads support breaks symbol versioning on Solaris 8/9 (PR
+	  # libstdc++/52189).
+          solaris2.[[89]]*)
+	    if test x$enable_symvers = xno; then
+	      ac_has_gthreads=yes
+	    elif test x$enable_gthreads = xyes; then
+	      AC_MSG_WARN([You have requested gthreads support, but])
+	      AC_MSG_WARN([this breaks symbol versioning.])
+	      ac_has_gthreads=yes
+	    else
+	      ac_has_gthreads=no
+	    fi
+	    ;;
+	  *)
+	    ac_has_gthreads=yes
+	    ;;
+        esac],
+       [ac_has_gthreads=no])
+  else
+    ac_has_gthreads=no
+  fi
 
   AC_MSG_RESULT([$ac_has_gthreads])
 
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -164,9 +164,6 @@  GLIBCXX_CHECK_GETTIMEOFDAY
 # NB: The default is [no], because otherwise it requires linking.
 GLIBCXX_ENABLE_LIBSTDCXX_TIME([no])
 
-# For gthread support
-GLIBCXX_CHECK_GTHREADS
-
 AC_LC_MESSAGES
 
 # For hardware_concurrency
@@ -335,6 +332,9 @@  GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT,
 # This depends on GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE.
 GLIBCXX_CONFIGURE_TESTSUITE
 
+# For gthread support.  Depends on GLIBCXX_ENABLE_SYMVERS.
+GLIBCXX_CHECK_GTHREADS
+
 # Define documentation rules conditionally.
 
 # See if makeinfo has been installed and is modern enough
diff --git a/libstdc++-v3/doc/xml/manual/configure.xml b/libstdc++-v3/doc/xml/manual/configure.xml
--- a/libstdc++-v3/doc/xml/manual/configure.xml
+++ b/libstdc++-v3/doc/xml/manual/configure.xml
@@ -161,6 +161,13 @@ 
      </para>
  </listitem></varlistentry>
 
+ <varlistentry><term><code>--enable-gthreads</code></term>
+ <listitem><para>Enable gthreads support.  If not explicitly specified, the
+	configure process enables it if possible.  It defaults to 'off' on
+	Solaris 8 and 9, where it would break symbol versioning.   This
+	option can change the library ABI.
+     </para>
+ </listitem></varlistentry>
 
  <varlistentry><term><code>--enable-libstdcxx-time</code></term>
  <listitem><para>This is an abbreviated form of