public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/28307]  New: [4.1/4.2 Regression] pthread functions in libgcc not weak any more on Tru64 UNIX
@ 2006-07-07 17:07 gcc-bugzilla at gcc dot gnu dot org
  2006-07-07 17:09 ` [Bug target/28307] " ro at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2006-07-07 17:07 UTC (permalink / raw)
  To: gcc-bugs


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  <aoliva@redhat.com>

        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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-07-03 13:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-07 17:07 [Bug target/28307] New: [4.1/4.2 Regression] pthread functions in libgcc not weak any more on Tru64 UNIX gcc-bugzilla at gcc dot gnu dot org
2006-07-07 17:09 ` [Bug target/28307] " ro at gcc dot gnu dot org
2006-07-07 17:58 ` ro at gcc dot gnu dot org
2006-09-10 16:57 ` jsm28 at gcc dot gnu dot org
2006-09-20 22:26 ` mmitchel at gcc dot gnu dot org
2006-09-21  2:35 ` mmitchel at gcc dot gnu dot org
2006-10-05  8:50 ` markus dot schoepflin at comsoft dot de
2007-02-14  9:40 ` [Bug target/28307] [4.1/4.2/4.3 " mmitchel at gcc dot gnu dot org
2007-07-03 13:36 ` ro at gcc dot gnu dot org
2007-07-03 13:41 ` ro at gcc dot gnu dot org
2007-07-03 13:43 ` ro at gcc dot gnu dot org
2007-07-03 13:45 ` ro at gcc dot gnu dot org
2007-07-03 13:46 ` ro at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).