From: Ken Raeburn Date: Wed, 23 May 2007 03:54:20 +0000 (+0000) Subject: On Solaris 10, define NO_WEAK_PTHREADS for the build. When that symbol is X-Git-Tag: krb5-1.7-alpha1~1104 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=151a777ff7f122fc97daf1ab748249d8de934452;p=krb5.git On Solaris 10, define NO_WEAK_PTHREADS for the build. When that symbol is defined, skip the weak and conditional references in k5-thread.h and always use the real pthread functions. ticket: 5560 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19556 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 2f02c5fe7..50715e5eb 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -207,12 +207,21 @@ if test "$enable_thread_support" = yes; then # don't exclude CFLAGS when linking. *sigh* PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L" ;; + solaris2.[1-9]) + # On Solaris 10 with gcc 3.4.3, the autoconf archive macro doesn't + # get the right result. XXX What about Solaris 9 and earlier? + if test "$GCC" = yes ; then + PTHREAD_CFLAGS="-D_REENTRANT -pthreads" + fi + ;; solaris*) # On Solaris 10 with gcc 3.4.3, the autoconf archive macro doesn't # get the right result. if test "$GCC" = yes ; then PTHREAD_CFLAGS="-D_REENTRANT -pthreads" fi + # On Solaris 10, the thread support is always available in libc. + AC_DEFINE(NO_WEAK_PTHREADS,1,[Define if references to pthread routines should be non-weak.]) ;; esac THREAD_SUPPORT=1 diff --git a/src/include/k5-thread.h b/src/include/k5-thread.h index 21c0688c6..fe1bbe173 100644 --- a/src/include/k5-thread.h +++ b/src/include/k5-thread.h @@ -406,7 +406,7 @@ typedef k5_os_nothread_mutex k5_os_mutex; Linux: Stub mutex routines exist, but pthread_once does not. - Solaris: In libc there's a pthread_once that doesn't seem to do + Solaris <10: In libc there's a pthread_once that doesn't seem to do anything. Bleah. But pthread_mutexattr_setrobust_np is defined only in libpthread. However, some version of GNU libc (Red Hat's Fedora Core 5, reportedly) seems to have that function, but no @@ -414,6 +414,12 @@ typedef k5_os_nothread_mutex k5_os_mutex; address. We now have tests to see if pthread_once actually works, so stick with that for now. + Solaris 10: The real thread support now lives in libc, and + libpthread is just a filter object. So we might as well use the + real functions unconditionally. Since we haven't got a test for + this property yet, we use NO_WEAK_PTHREADS defined in aclocal.m4 + depending on the OS type. + IRIX 6.5 stub pthread support in libc is really annoying. The pthread_mutex_lock function returns ENOSYS for a program not linked against -lpthread. No link-time failure, no weak symbols, etc. @@ -428,7 +434,7 @@ typedef k5_os_nothread_mutex k5_os_mutex; If we find a platform with non-functional stubs and no weak references, we may have to resort to some hack like dlsym on the symbol tables of the current process. */ -#ifdef HAVE_PRAGMA_WEAK_REF +#if defined(HAVE_PRAGMA_WEAK_REF) && !defined(NO_WEAK_PTHREADS) # pragma weak pthread_once # pragma weak pthread_mutex_lock # pragma weak pthread_mutex_unlock @@ -460,11 +466,9 @@ extern int krb5int_pthread_loaded(void); # endif #endif -#ifdef HAVE_PRAGMA_WEAK_REF +#if defined(HAVE_PRAGMA_WEAK_REF) && !defined(NO_WEAK_PTHREADS) # define USE_PTHREAD_LOCK_ONLY_IF_LOADED -#endif -#ifdef HAVE_PRAGMA_WEAK_REF /* Can't rely on useful stubs -- see above regarding Solaris. */ typedef struct { pthread_once_t o;