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]
Other format: [Raw text]

gcc-3.2.2, IRIX6.5, pthreads

builds successfully, but somehow fails to build a working executable (even though it passes 3-stage build and comparison???)

gcc-3.2.2 on

Reading specs from
Configured with: ../gcc-3.2.2/configure --srcdir=/home/me/local/src/gcc-3.2.2
--prefix=/home/me/local/gcc-3.2.2 --exec-prefix=/home/me/local/gcc-3.2.2/IRIX
--enable-languages=c++,f77,java --enable-threads=posix
Thread model: posix
gcc version 3.2.2

IRIX64 6.5.12m

While many folks have reported that gcc-3.x on IRIX 6.5 works when configured using --enable-threads=posix, I am unconvinced that they actually tried to compile anything or run the tests after building it.

I built a simple shared lib and executable; the build itself succeeded.
However, when I tried to run the executable, I got:

327766:./usedll: rld: Error: unresolvable symbol in
327766:./usedll: rld: Error: unresolvable symbol in
327766:./usedll: rld: Error: unresolvable symbol in
327766:./usedll: rld: Error: unresolvable symbol in

Nothing in the shared lib or the executable is multithreaded.

However, if I link explicitly with -lpthread, then I get:
ld32: WARNING 84: /usr/lib32/ is not used for resolving any symbol. But now, the executable successfully executes.

I rebuilt gcc after applying (an updated version of) this patch The updated
version is attached. However, as Ranier reported, this didn't solve the problem; I got exactly the same symptoms as before. I've searched the archives and see no further discussion of this issue; has anybody looked at gcc with posix threads on IRIX in the last 18 months?

I punted and rebuilt gcc (again...) without threads, but still...


P.S. Also, I found that 'make install DESTDIR=...' doesn't honor the DESTDIR when installing multilibs of libstdc++ -- that is, "regular" libstdc++ is installed under DESTDIR along with everything else; but the mabi=64 libstdc++ goes into the configured directory, not $(DESTDIR)/....

This is an updated version of Rainer Orth's version of H.J. Lu's
  Lu  :
to enable posix threads on IRIX 6.  See also

Fri Jul 27 16:33:45 2001  H.J. Lu <hjl at gnu dot org>
                          Rainer Orth  <ro at TechFak dot Uni-Bielefeld dot DE>
                          Charles Wilson <cwilson at ece dot gatech dot edu>

        * 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.

diff -urN gcc-3.2.2-orig/gcc/config.gcc	gcc-3.2.2/gcc/config.gcc
--- gcc-3.2.2-orig/gcc/config.gcc	Wed Mar  5 18:02:56 2003
+++ gcc-3.2.2/gcc/config.gcc	Wed Mar  5 18:03:30 2003
@@ -2211,9 +2211,9 @@
 	tmake_file="mips/t-iris mips/t-iris6"
-#	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"
diff -urN gcc-3.2.2-orig/gcc/gthr-posix.h gcc-3.2.2/gcc/gthr-posix.h
--- gcc-3.2.2-orig/gcc/gthr-posix.h	Wed Mar  5 18:05:19 2003
+++ gcc-3.2.2/gcc/gthr-posix.h	Wed Mar  5 18:07:03 2003
@@ -77,10 +77,14 @@
 #pragma weak pthread_setschedparam
+#define PTHREAD_ACTIVE_FUNCTION pthread_create
 static inline int
 __gthread_active_p (void)
-  static void *const __gthread_active_ptr = (void *) &pthread_create;
+  static void *const __gthread_active_ptr = (void *) &PTHREAD_ACTIVE_FUNCTION;
   return __gthread_active_ptr != 0;
diff -urN gcc-3.2.2-orig/gcc/config/mips/iris6.h gcc-3.2.2/gcc/config/mips/iris6.h
--- gcc-3.2.2-orig/gcc/config/mips/iris6.h	Wed Mar  5 18:08:44 2003
+++ gcc-3.2.2/gcc/config/mips/iris6.h	Wed Mar  5 18:09:31 2003
@@ -522,3 +522,12 @@
 %{shared:-hidden_symbol __do_global_ctors,__do_global_ctors_1,__do_global_dtors} \
 -_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
diff -urN gcc-3.2.2-orig/gcc/doc/tm.texi gcc-3.2.2/gcc/doc/tm.texi
--- gcc-3.2.2-orig/gcc/doc/tm.texi	Tue Dec 10 16:01:54 2002
+++ gcc-3.2.2/gcc/doc/tm.texi	Wed Mar  5 18:16:04 2003
@@ -8616,6 +8616,12 @@
 @end deftypefn
 @table @code
+ at 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}.
 @item MD_CAN_REDIRECT_BRANCH(@var{branch1}, @var{branch2})

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