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] PR target/28247: Fix bit-rot of gthr-solaris.h


PR target/28247 is listed as a P1 regression on mainline and the 4.1
branch for the boostrap failure building on Solaris targets when
configured with --enable-threads=solaris.  The problem is that
changes to gthr-solaris.h mean that new inline code outside of #ifdef
_LIBOBJC calls functions only prototypes inside #ifdef _LIBOBJ.  The
obvious fix is to shuffle around the function prototypes.  Whilst I was
there I also cut'n'paste the "UNUSED" idiom from gthr-single.h, to
silence an unused argument warning in __gthread_key_delete in the same
file.

The good news is that the following patch allows a "--with-gnu-as
--enable-threads=solaris" build of C, C++, objc and fortran on
i386-pc-solaris2.10 to now complete, and the test results of gcc, g++
and gfortran look identical to the default thread model.  The bad
news is that I'm seeing a lot of timeout problems in the objc
testsuite.  I'll try to investigate, but the pre-existing run-time
behaviour of gth-solaris should be unchanged by the patch below.

This patch at least moves us a step forward, so OK for mainline/4.1?
Many thanks to the folks who reviewed/helped with my previous
Solaris/x86 patches, that have aided the investigation of this P1.



2006-07-23  Roger Sayle  <roger@eyesopen.com>

	PR target/28247
	* gthr-solaris.h: Prototype __gthrw forms of thr_self, mutex_init and
	mutex_destroy even when !_LIBOOBJC.  Remove duplicate prototype of
	the __gthrw form of thr_keycreate.
	(__gthread_key_delete): Silence the unused argument warning.


Index: gthr-solaris.h
===================================================================
*** gthr-solaris.h	(revision 115638)
--- gthr-solaris.h	(working copy)
***************
*** 1,6 ****
  /* Threads compatibility routines for libgcc2 and libobjc.  */
  /* Compile this one with gcc.  */
! /* Copyright (C) 1997, 1999, 2000, 2004, 2005
     Free Software Foundation, Inc.

  This file is part of GCC.
--- 1,6 ----
  /* Threads compatibility routines for libgcc2 and libobjc.  */
  /* Compile this one with gcc.  */
! /* Copyright (C) 1997, 1999, 2000, 2004, 2005, 2006
     Free Software Foundation, Inc.

  This file is part of GCC.
*************** Software Foundation, 51 Franklin Street,
*** 39,44 ****
--- 39,50 ----
  #include <thread.h>
  #include <errno.h>

+ #ifdef __cplusplus
+ #define UNUSED(x)
+ #else
+ #define UNUSED(x) x __attribute__((unused))
+ #endif
+
  typedef thread_key_t __gthread_key_t;
  typedef struct {
    mutex_t mutex;
*************** __gthrw(thr_keycreate)
*** 69,84 ****
  __gthrw(thr_getspecific)
  __gthrw(thr_setspecific)
  __gthrw(thr_create)

  __gthrw(mutex_lock)
  __gthrw(mutex_trylock)
  __gthrw(mutex_unlock)

  #ifdef _LIBOBJC
  __gthrw(thr_exit)
- __gthrw(thr_keycreate)
  __gthrw(thr_getprio)
- __gthrw(thr_self)
  __gthrw(thr_setprio)
  __gthrw(thr_yield)

--- 75,91 ----
  __gthrw(thr_getspecific)
  __gthrw(thr_setspecific)
  __gthrw(thr_create)
+ __gthrw(thr_self)

+ __gthrw(mutex_init)
+ __gthrw(mutex_destroy)
  __gthrw(mutex_lock)
  __gthrw(mutex_trylock)
  __gthrw(mutex_unlock)

  #ifdef _LIBOBJC
  __gthrw(thr_exit)
  __gthrw(thr_getprio)
  __gthrw(thr_setprio)
  __gthrw(thr_yield)

*************** __gthrw(cond_wait)
*** 88,95 ****
  __gthrw(cond_broadcast)
  __gthrw(cond_signal)

- __gthrw(mutex_init)
- __gthrw(mutex_destroy)
  #endif

  #if SUPPORTS_WEAK && GTHREAD_USE_WEAK
--- 95,100 ----
*************** __gthread_key_create (__gthread_key_t *k
*** 434,440 ****
  }

  static inline int
! __gthread_key_delete (__gthread_key_t key)
  {
    /* Not possible.  */
    return -1;
--- 439,445 ----
  }

  static inline int
! __gthread_key_delete (__gthread_key_t UNUSED (key))
  {
    /* Not possible.  */
    return -1;
*************** __gthread_recursive_mutex_unlock (__gthr
*** 544,547 ****
--- 549,554 ----

  #endif /* _LIBOBJC */

+ #undef UNUSED
+
  #endif /* ! GCC_GTHR_SOLARIS_H */


Roger
--


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