summaryrefslogtreecommitdiff
path: root/gcc/gthr-posix.h
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-19 21:49:58 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-19 21:49:58 +0000
commit3b19d3be1ae915879fa5f404b2cb88242058d980 (patch)
tree0f789b65c451aecafb861e55b6b36f5b18d4973b /gcc/gthr-posix.h
parent158f58e7d3865cf286b6ad8c2874c1029e2d7a03 (diff)
downloadgcc-3b19d3be1ae915879fa5f404b2cb88242058d980.tar.gz
* 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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111282 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gthr-posix.h')
-rw-r--r--gcc/gthr-posix.h45
1 files changed, 37 insertions, 8 deletions
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h
index 38fc3813755..c06e99f0f6d 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) \
- static __typeof(name) __gthrw_ ## name __attribute__ ((__weakref__(#name)));
+# define __gthrw2(name,name2) \
+ static __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)