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]

3.0.1 PATCH: Enable POSIX threads for IRIX 6

This is an updated version of H. J. Lu's patch

with an explanation why it's necessary added to iris6.h, a fix for

and an update to config.gcc to enable POSIX threads on IRIX 6 with
--enable-threads when no specific thread model is specified.  An update to
install.tex mentioning patch prerequisites on IRIX 6.[2-4] will follow.

H.J., it would really have helped if you had fully stated why one needs
your patch on IRIX 6.  The explanation you gave (pthread_create is in libc)
is not sufficient, since this is true on Solaris 2 as well.  But (unlike
IRIX 6), Solaris 2 has stub versions of *all* pthread functions in libc,
not only a few of them as IRIX 6 has, and their error returns are
reasonable to allow gthr-posix.h to work even when __gthr_active_p ()
returns true without -lpthread being linked in.

A bootstrap on mips-sgi-irix6.5 finished successfully (ran for about 12
hours ;-(), make check is in progress.

Ok for branch and mainline if it passes without regressions?


Rainer Orth, Faculty of Technology, Bielefeld University

Email: ro@TechFak.Uni-Bielefeld.DE

Fri Jul 27 16:33:45 2001  H.J. Lu <>
		          Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* hpux_irix_threads.c (GC_collecting) [!HPUX_THREADS]: Declare

	* config.gcc (mips-sgi-irix6*): Use pthreads if enabled.
	* gthr-posix.h (PTHREAD_ACTIVE_FUNCTION): Provide default.
	(__gthread_active_ptr): Use it.
	* config/mips/iris6.h (PTHREAD_ACTIVE_FUNCTION): Define.
	* doc/tm.texi (PTHREAD_ACTIVE_FUNCTION): Document it.

Index: boehm-gc/hpux_irix_threads.c
RCS file: /cvs/gcc/gcc/boehm-gc/Attic/hpux_irix_threads.c,v
retrieving revision
diff -u -p -r1.1.1.2 hpux_irix_threads.c
--- hpux_irix_threads.c	2000/04/19 02:29:15
+++ hpux_irix_threads.c	2001/08/02 12:39:29
@@ -657,7 +657,8 @@ GC_pthread_create(pthread_t *new_thread,
 /* For now we use the pthreads locking primitives on HP/UX */
-GC_bool GC_collecting = 0; /* A hint that we're in the collector and       */
+VOLATILE GC_bool GC_collecting = 0;
+			/* A hint that we're in the collector and       */
                         /* holding the allocation lock for an           */
                         /* extended period.                             */
Index: gcc/config.gcc
RCS file: /cvs/gcc/gcc/gcc/config.gcc,v
retrieving revision
diff -u -p -r1.27.2.11 config.gcc
--- config.gcc	2001/07/25 01:48:16
+++ config.gcc	2001/08/02 12:39:30
@@ -2215,9 +2246,9 @@ mips-sgi-irix6*)		# SGI System V.4., IRI
-#	if test x$enable_threads = xyes; then
-#		thread_file='irix'
-#	fi
+	if test x$enable_threads = xyes; then
+		thread_file=posix
+	fi
 	tm_file="mips/elf.h mips/vxworks.h"
Index: gcc/gthr-posix.h
RCS file: /cvs/gcc/gcc/gcc/gthr-posix.h,v
retrieving revision
diff -u -p -r1.11.6.6 gthr-posix.h
--- gthr-posix.h	2001/07/18 11:02:20
+++ gthr-posix.h	2001/08/02 12:39:31
@@ -77,7 +77,11 @@ typedef pthread_mutex_t __gthread_mutex_
 #pragma weak pthread_setschedparam
-static void *__gthread_active_ptr = (void *) &pthread_create;
+#define PTHREAD_ACTIVE_FUNCTION pthread_create
+static void *__gthread_active_ptr = (void *) &PTHREAD_ACTIVE_FUNCTION;
 static inline int
 __gthread_active_p (void)
Index: gcc/config/mips/iris6.h
RCS file: /cvs/gcc/gcc/gcc/config/mips/iris6.h,v
retrieving revision
diff -u -p -r1.28.2.6 iris6.h
--- iris6.h	2001/07/17 12:51:31
+++ iris6.h	2001/08/02 12:39:35
@@ -560,3 +560,11 @@ do {									 \
 %{shared:-hidden_symbol __do_global_ctors,__do_global_dtors,__EH_FRAME_BEGIN__,__frame_dummy} \
 -_SYSTYPE_SVR4 -woff 131 \
 %{mabi=32: -32}%{mabi=n32: -n32}%{mabi=64: -64}%{!mabi*: -n32}"
+/* The IRIX 6 libc includes stub versions of some of the pthread functions,
+   but lacks several necessary ones.  If the default PTHREAD_ACTIVE_FUNCTION,
+   pthread_created, were used to detect if a given program uses threads,
+   it would always appear to do so, but later attempts to invoke any of the
+   missing functions only finds the weak definition in gthr-posix.h and
+   causes rld to terminate the process.  */
+#define PTHREAD_ACTIVE_FUNCTION pthread_once
Index: gcc/doc/tm.texi
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision
diff -u -p -r1.2.2.12 tm.texi
--- tm.texi	2001/07/23 20:33:00
+++ tm.texi	2001/08/02 12:39:43
@@ -8565,4 +8565,10 @@ for computing one of @var{exp}'s operand
 is to be ignored.
 This macro should return the result of the call to the built-in function.
+@code{PTHREAD_ACTIVE_FUNCTION} defines the pthread library function
+used to detect if a program is using the pthread library.  The default
+one is @code{pthread_create}.
 @end table

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