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

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
mips-sgi-irix6.5

Reading specs from
/home/me/local/gcc-3.2.2/IRIX/lib/gcc-lib/mips-sgi-irix6.5/3.2.2/specs
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
--with-libiconv-prefix=/home/me/local/IRIX
--enable-version-specific-runtime-libs
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
/home/me/local/gcc-3.2.2/IRIX/lib/gcc-lib/mips-sgi-irix6.5/3.2.2/libstdc++.so.6:
pthread_once
327766:./usedll: rld: Error: unresolvable symbol in
/home/me/local/gcc-3.2.2/IRIX/lib/gcc-lib/mips-sgi-irix6.5/3.2.2/libstdc++.so.6:
pthread_setspecific
327766:./usedll: rld: Error: unresolvable symbol in
/home/me/local/gcc-3.2.2/IRIX/lib/gcc-lib/mips-sgi-irix6.5/3.2.2/libstdc++.so.6:
pthread_key_create
327766:./usedll: rld: Error: unresolvable symbol in
/home/me/local/gcc-3.2.2/IRIX/lib/gcc-lib/mips-sgi-irix6.5/3.2.2/libstdc++.so.6:
pthread_getspecific

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/libpthread.so is not used for resolving any symbol. But now, the executable successfully executes.


I rebuilt gcc after applying (an updated version of) this patch http://gcc.gnu.org/ml/gcc-patches/2001-08/msg00072.html. 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...

--Chuck

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
patch:
  Orth: http://gcc.gnu.org/ml/gcc-patches/2001-08/msg00072.html
  Lu  : http://gcc.gnu.org/ml/gcc-patches/2001-07/msg01854.html
to enable posix threads on IRIX 6.  See also
  http://gcc.gnu.org/ml/gcc/2001-08/msg00111.html

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>

        gcc:
        * 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 @@
 	fi
 	tmake_file="mips/t-iris mips/t-iris6"
 	xm_defines=POSIX
-#	if test x$enable_threads = xyes; then
-#		thread_file='irix'
-#	fi
+	if test x$enable_threads = xyes; then
+		thread_file='posix'
+	fi
 	;;
 mips-wrs-vxworks)
 	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
 #endif
 
+#ifndef PTHREAD_ACTIVE_FUNCTION
+#define PTHREAD_ACTIVE_FUNCTION pthread_create
+#endif
+
 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 findex PTHREAD_ACTIVE_FUNCTION
+ at item PTHREAD_ACTIVE_FUNCTION
+ 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}.
+
 @findex MD_CAN_REDIRECT_BRANCH
 @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]