This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
4.1/4.2 PATCH: Restore weak definitions of pthread functions on Tru64 UNIX (PR target/28307)
- From: Rainer Orth <ro at TechFak dot Uni-Bielefeld dot DE>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Jul 2006 21:23:30 +0200 (MEST)
- Subject: 4.1/4.2 PATCH: Restore weak definitions of pthread functions on Tru64 UNIX (PR target/28307)
This patch fixes the issues described in PRs libgcj/28189
[4.1/4.2 Regression] Many libjava execution tests time out on Tru64 UNIX
and target/28307
[4.1/4.2 Regression] pthread functions in libgcc not weak any more on Tru64 UNIX
It turns out that this patch
005-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.
turned all definitions of pthread functions in libgcc* on Tru64 UNIX from
weak definitions into strong definitions by losing the #pragma weak
declarations. This breaks gctest (where I discovered the issue as
described in the PR), causes many ACATS failures and most libjava tests to
time out, so a full bootstrap and test cycle on Tru64 UNIX takes several
days ;-(
Once the root cause became clear, the fix became fairly trivial: via a new
__gthrw_pragma macro, the missing #pragma weak declarations are
reintroduced on Tru64 UNIX by providing a non-default definition in
gthr-posix.c where they are necessary to make the function weak.
With this patch (and a couple of other fixes or workarounds for much
unrelated breakage ;-), I could finally get a clean mainline bootstrap on
alpha-dec-osf4.0f and much better test results than I had in months:
http://gcc.gnu.org/ml/gcc-testresults/2006-07/msg00509.html
Since this is a regression on both mainline and the 4.1 branch, ok for both?
Mainline testing already finished successfully, I need to test the 4.1
branch before committing, but the issues is the same there.
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Wed Jul 12 21:16:20 2006 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
PR target/28307
* gthr-posix.h [SUPPORTS_WEAK && GTHREAD_USE_WEAK]
(__gthrw_pragma): Provide default definition.
(__gthrw2): Use it.
* gthr-posix.c (__gthrw_pragma): Define.
Index: gcc/gthr-posix.c
===================================================================
--- gcc/gthr-posix.c (revision 115313)
+++ gcc/gthr-posix.c (working copy)
@@ -1,6 +1,6 @@
/* POSIX threads dummy routines for systems without weak definitions. */
/* Compile this one with gcc. */
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC.
@@ -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"
@@ -75,7 +76,7 @@ pthread_create (pthread_t *thread ATTRIB
}
int
-pthread_cancel(pthread_t thread ATTRIBUTE_UNUSED)
+pthread_cancel (pthread_t thread ATTRIBUTE_UNUSED)
{
return 0;
}
Index: gcc/gthr-posix.h
===================================================================
--- gcc/gthr-posix.h (revision 115313)
+++ gcc/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 type)
# define __gthrw_(name) __gthrw_ ## name
#else
# define __gthrw2(name,name2,type)