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

PATCH: Fix bootstrap with --enable-threads=solaris (PR target/41810)


As reported in PR target/41810, gcc 4.4.2 fails bootstrap in libstdc++
when configured with --enable-threads=solaris:

In function 'int __gthread_mutex_destroy(__gthread_mutex_t*)':
/home/gprog/build/i386-pc-solaris2.11/libstdc++-v3/include/i386-pc-solaris2.11/bits/gthr-default.h:466:
error: '__mutex' was not declared in this scope

The problem is that __gthread_mutex_destroy incorrectly marked the
__mutex argument as unused using the UNUSED() macro which simply elides
the parameter name.  But the parameter is used, so this breaks libstdc++
compilation and removing the wrong UNUSED marker is the obvious fix.

To get mainline to bootstrap with --enable-threads=solaris, one needs to
specify --disable-libgcj, since boehm-gc doesn't support solaris threads
and configure fails there.

With those changes, mainline bootstrap completed on i386-pc-solaris2.10,
but there are three testsuite regressions compared to a pthread bootstrap:

FAIL: objc/execute/exceptions/foward-1.m execution,  -O0 -fgnu-runtime
FAIL: objc/execute/exceptions/foward-1.m execution,  -O1 -fgnu-runtime
FAIL: objc/execute/exceptions/foward-1.m execution,  -O2 -fgnu-runtime
FAIL: objc/execute/exceptions/foward-1.m execution,  -O3 -fomit-frame-pointer -fgnu-runtime
FAIL: objc/execute/exceptions/foward-1.m execution,  -O3 -fomit-frame-pointer -funroll-loops -fgnu-runtime
FAIL: objc/execute/exceptions/foward-1.m execution,  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions -fgnu-runtime
FAIL: objc/execute/exceptions/foward-1.m execution,  -O3 -g -fgnu-runtime
FAIL: objc/execute/exceptions/foward-1.m execution,  -Os -fgnu-runtime

only for 64-bit.  I'm still trying to debug those; unfortunately, I
cannot get a 64-bit gdb 7.0 to debug 64-bit binaries: it errors out with

Reading symbols from /usr/bin/amd64/ls...I'm sorry, Dave, I can't do that.  Symbol format `elf64-x86-64' unknown.

I've no idea yet why this happens.

The other two regressions are in libstdc++, both 32 and 64 bit:

+FAIL: 17_intro/headers/c++200x/all_pedantic_errors.cc (test for excess errors)

/vol/gcc/obj/gcc-4.5.0-20091116/10-gcc-thread/i386-pc-solaris2.10/libstdc++-v3/include/i386-pc-solaris2.10/bits/gthr-default.h:105:1: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object

This can be fixed along the same lines as is done in gthr-posix.h.

+WARNING: program timed out.
+FAIL: 18_support/pthread_guard.cc execution test

I've as yet no idea why this fails: pthreads and solaris threads should
be interoperable, and all other thread tests pass even with both mixed
in the same executable.

I'll investigate later.

To avoid the obvious confusion here, I've added an explanation what
--enable-threads=solaris means.  I've tested that change with make info
dvi html.

Ok for mainline?

        Rainer

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


2009-11-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/41810
	* gthr-solaris.h (__gthread_mutex_destroy): Remove UNUSED.
	[SUPPORTS_WEAK && GTHREAD_USE_WEAK] (__gthread_active_p): Use
	__extension__ to allow cast from function pointer to object
	pointer in C++.
	* doc/install.texi (--enable-threads): Clarify use of Solaris
	threads.

Index: gcc/gthr-solaris.h
===================================================================
--- gcc/gthr-solaris.h	(revision 154216)
+++ gcc/gthr-solaris.h	(working copy)
@@ -102,7 +102,8 @@
 static inline int
 __gthread_active_p (void)
 {
-  static void *const __gthread_active_ptr = (void *) &__gthrw_(thr_create);
+  static void *const __gthread_active_ptr
+    = __extension__ (void *) &__gthrw_(thr_create);
   return __gthread_active_ptr != 0;
 }
 
@@ -460,7 +461,7 @@
 }
 
 static inline int
-__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(__mutex))
+__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
 {
   if (__gthread_active_p ())
     return __gthrw_(mutex_destroy) (__mutex);
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi	(revision 154216)
+++ gcc/doc/install.texi	(working copy)
@@ -1118,7 +1118,8 @@
 @item single
 Disable thread support, should work for all platforms.
 @item solaris
-Sun Solaris 2 thread support.
+Sun Solaris 2/Unix International thread support.  Only use this if you
+really need to use this legacy API instead of the default, @samp{posix}.
 @item vxworks
 VxWorks thread support.
 @item win32


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