While investigating the root cause of PR libgcj/28189, I noticed that both on the 4.1 branch and on mainline (where the libjava testsuite timeouts occur) the boehm-gc test had started failing as well (which easily goes unnoticed due to PR boehm-gc/11412): gctest fails like this:
Key creation failed 18446744073709551615 Test failed FAIL: gctest It turns out that this happens when pthread_key_create returns -1. Printing errno at this point reveals that errno is 0, which is unexpected and shouldn't happen with the function from libpthread. Upon further investigation, it turned out that the pthread function definitions from gthr-posix.c aren't marked weak any more, so the dummy function definitions make it into libgcc.a and libgcc_s.so.1, which of course every usage of the real pthread functions. This was introduce by this patch and it's successors: 2005-11-09 Alexandre Oliva <[EMAIL PROTECTED]> PR other/4372 * gthr-dce.h, gthr-posix.h, gthr-posix95.h, gthr-solaris.h, gthr-tpf.h: Define __gthrw. For all identifiers that might be weak, introduce weakrefs or non-weak aliases with __gthrw, and prefix all uses with __ghtrw. Before that change, there were #pragma weak declarations for all functions defined in gthr-posix.c, so those definitions became weak. Afterwards, those declarations were lost and the definitions became strong. Environment: System: OSF1 bartok V5.1 2650 alpha Machine: alpha host: alpha-dec-osf5.1b build: alpha-dec-osf5.1b target: alpha-dec-osf5.1b configured with: /vol/gcc/src/gcc/configure --prefix=/vol/gcc --with-local-prefix=/vol/gcc --disable-nls --host alpha-dec-osf5.1b --build alpha-dec-osf5.1b --target alpha-dec-osf5.1b --with-gmp-dir=/vol/gnu/obj/gmp-4.1.3 --with-mpfr-dir=/vol/gnu/obj/gmp-4.1.3/mpfr --enable-languages=c,c++,fortran,java,objc,ada --disable-libmudflap How-To-Repeat: Investigate e.g. the pthread_key_create definition in libgcc.a and libgcc_s.so.1 with stdump: On the 4.0 branch, it is marked weak: 6. (file 0) (0x10) pthread_key_create Proc Text symref (indexNil) (weakext) while on mainline and the 4.1 branch this is lost: 6. (file 0) (0x10) pthread_key_create Proc Text symref (indexNil) ------- Comment #1 from ro at techfak dot uni-bielefeld dot de 2006-07-07 17:06 ------- Fix: I'm currently testing the following patch (which is difficult due to lots of other unrelated breakage on mainline ;-). It probably needs some cleanup and comments, but gives the basic idea. Index: gthr-posix.c =================================================================== --- gthr-posix.c (revision 115230) +++ gthr-posix.c (working copy) @@ -28,6 +28,7 @@ Software Foundation, 51 Franklin Street, #include "tconfig.h" #include "tm.h" +# define __gthrw_pragma(pragma) _Pragma (#pragma) /* Define so we provide weak definitions of functions used by libobjc only. */ #define _LIBOBJC_WEAK #include "gthr.h" Index: gthr-posix.h =================================================================== --- gthr-posix.h (revision 115230) +++ gthr-posix.h (working copy) @@ -59,8 +59,12 @@ typedef pthread_mutex_t __gthread_recurs #endif #if SUPPORTS_WEAK && GTHREAD_USE_WEAK +# ifndef __gthrw_pragma +# define __gthrw_pragma(pragma) +# endif # define __gthrw2(name,name2,type) \ - static __typeof(type) name __attribute__ ((__weakref__(#name2))); + static __typeof(type) name __attribute__ ((__weakref__(#name2))); \ + __gthrw_pragma(weak name2) # define __gthrw_(name) __gthrw_ ## name #else # define __gthrw2(name,name2,type) -- Summary: [4.1/4.2 Regression] pthread functions in libgcc not weak any more on Tru64 UNIX Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ro at techfak dot uni-bielefeld dot de GCC build triplet: alpha-dec-osf5.1b GCC host triplet: alpha-dec-osf5.1b GCC target triplet: alpha-dec-osf5.1b http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28307