This is the mail archive of the 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]

Solaris 2.6 EH failures

The problem is a bad interaction with the thread support.  Solaris 2.6
has POSIX thread support, so configure chooses to use that one.  If you
then run a testcase that uses EH, we end up in an infinite loop in
eh_context_initialize, because pthread_once returns zero but does not do
anything.  If you compile that testcase with -lpthread, then it works fine.

It seems that if you don't use -lpthread, then the pthread function calls
are mapped to a helper function named _return_zero that does nothing but
return zero.  This is perhaps a feature of the Solaris shared library support.
Maybe if you call a function that doesn't exist it gives you _return_zero?

If using POSIX thread support under Solaris 2.6, we either need to ensure
that -lpthread is always linked in with libgcc.a, or else we need to
fix eh_context_initialize to handle this failure mode.

If a user actually wants the thread support to work, then they will add
the -lpthread themselves, so a workaround in libgcc2.c should be OK I think.

This seems to work though perhaps there are better solutions.  I haven't
looked at the thread support in any detail as yet.

Fri Mar  6 18:00:18 1998  Jim Wilson  <>

	* libgcc2.c (eh_context_initialize): Check get_eh_context instead of
	return value to see if __gthread_once worked.

Index: libgcc2.c
RCS file: /egcs/carton/cvsfiles/egcs/gcc/libgcc2.c,v
retrieving revision 1.26
diff -p -r1.26 libgcc2.c
*** libgcc2.c	1998/02/13 05:40:25	1.26
--- libgcc2.c	1998/03/07 01:59:57
*************** eh_context_initialize ()
*** 3132,3142 ****
  #if __GTHREADS
    static __gthread_once_t once = __GTHREAD_ONCE_INIT;
!   if (__gthread_once (&once, eh_threads_initialize) == -1)
!     {
!       /* Use static version of EH context. */
!       get_eh_context = &eh_context_static;
!     }
  #else /* no __GTHREADS */
--- 3132,3144 ----
  #if __GTHREADS
    static __gthread_once_t once = __GTHREAD_ONCE_INIT;
!   __gthread_once (&once, eh_threads_initialize);
!   /* If it failed, use static version of EH context.  We can't check the
!      return value, because Solaris 2.6 gets this wrong if linking without
!      -lpthreads.  */
!   if (get_eh_context == eh_context_initialize)
!     get_eh_context = &eh_context_static;
  #else /* no __GTHREADS */

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