aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-02-24 01:47:22 +0000
committerMark Mitchell <mark@codesourcery.com>2006-02-24 01:47:22 +0000
commitc34b9e2af879a0577e33b811f56f870bed333997 (patch)
treedd3e53902621b925a83902a0feed91cc5241c122
parent4d087b6f9353c7c1daecb1bf265c7a7f3f2e6f53 (diff)
Backport:
2006-02-20 Roger Sayle <roger@eyesopen.com> * gthr-posix.h: On Tru64, map __gthr_foo as a weak reference to __foo and not foo when _PTHREAD_USE_MANGLED_NAMES_ is defined. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_1-branch@111412 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/gthr-posix.h45
2 files changed, 44 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a94de7c5b6a..dfa8b768def 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,13 @@
2006-02-23 Mark Mitchell <mark@codesourcery.com>
Backport:
+ 2006-02-20 Roger Sayle <roger@eyesopen.com>
+ * gthr-posix.h: On Tru64, map __gthr_foo as a weak reference to
+ __foo and not foo when _PTHREAD_USE_MANGLED_NAMES_ is defined.
+
+2006-02-23 Mark Mitchell <mark@codesourcery.com>
+
+ Backport:
2006-02-21 Jakub Jelinek <jakub@redhat.com>
PR middle-end/26379
* combine.c (simplify_shift_const_1): Disable nested shifts
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h
index 4571b1646cf..9147c4a915e 100644
--- a/gcc/gthr-posix.h
+++ b/gcc/gthr-posix.h
@@ -1,6 +1,6 @@
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
-/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GCC.
@@ -59,33 +59,61 @@ typedef pthread_mutex_t __gthread_recursive_mutex_t;
#endif
#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
-# define __gthrw(name) \
- extern __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
+# define __gthrw2(name,name2) \
+ extern __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name2)));
# define __gthrw_(name) __gthrw_ ## name
#else
-# define __gthrw(name)
+# define __gthrw2(name,name2)
# define __gthrw_(name) name
#endif
+/* Typically, __gthrw_foo is a weak refernce to symbol foo. */
+#define __gthrw(name) __gthrw2(name,name)
+
+/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
+ map a subset of the POSIX pthread API to mangled versions of their
+ names. */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw2(pthread_once,__pthread_once)
+__gthrw2(pthread_getspecific,__pthread_getspecific)
+__gthrw2(pthread_setspecific,__pthread_setspecific)
+__gthrw2(pthread_create,__pthread_create)
+__gthrw2(pthread_cancel,__pthread_cancel)
+__gthrw2(pthread_mutex_lock,__pthread_mutex_lock)
+__gthrw2(pthread_mutex_trylock,__pthread_mutex_trylock)
+__gthrw2(pthread_mutex_unlock,__pthread_mutex_unlock)
+__gthrw2(pthread_mutex_init,__pthread_mutex_init)
+#else
__gthrw(pthread_once)
-__gthrw(pthread_key_create)
-__gthrw(pthread_key_delete)
__gthrw(pthread_getspecific)
__gthrw(pthread_setspecific)
__gthrw(pthread_create)
__gthrw(pthread_cancel)
-
__gthrw(pthread_mutex_lock)
__gthrw(pthread_mutex_trylock)
__gthrw(pthread_mutex_unlock)
+__gthrw(pthread_mutex_init)
+#endif
+
+__gthrw(pthread_key_create)
+__gthrw(pthread_key_delete)
__gthrw(pthread_mutexattr_init)
__gthrw(pthread_mutexattr_settype)
__gthrw(pthread_mutexattr_destroy)
-__gthrw(pthread_mutex_init)
#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
/* Objective-C. */
+#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
+__gthrw2(pthread_cond_broadcast,__pthread_cond_broadcast)
+__gthrw2(pthread_cond_destroy,__pthread_cond_destroy)
+__gthrw2(pthread_cond_init,__pthread_cond_init)
+__gthrw2(pthread_cond_signal,__pthread_cond_signal)
+__gthrw2(pthread_cond_wait,__pthread_cond_wait)
+__gthrw2(pthread_exit,__pthread_exit)
+__gthrw2(pthread_mutex_destroy,__pthread_mutex_destroy)
+__gthrw2(pthread_self,__pthread_self)
+#else
__gthrw(pthread_cond_broadcast)
__gthrw(pthread_cond_destroy)
__gthrw(pthread_cond_init)
@@ -94,6 +122,7 @@ __gthrw(pthread_cond_wait)
__gthrw(pthread_exit)
__gthrw(pthread_mutex_destroy)
__gthrw(pthread_self)
+#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
#ifdef _POSIX_PRIORITY_SCHEDULING
#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
__gthrw(sched_get_priority_max)