summaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-13 14:13:19 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-13 14:13:19 +0000
commitef6f748f9b28459bd27e09edecca6eeaf42f3df7 (patch)
treea093e47020ed740781ff421875451b061f428494 /libgcc
parent2466cdbf4be6dc8d97082310f02f72f905a6c420 (diff)
downloadgcc-ef6f748f9b28459bd27e09edecca6eeaf42f3df7.tar.gz
2012-06-13 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 188512 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@188515 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog12
-rw-r--r--libgcc/config/i386/libgcc-bsd.ver1
-rw-r--r--libgcc/config/i386/libgcc-glibc.ver2
-rw-r--r--libgcc/config/i386/libgcc-sol2.ver1
-rw-r--r--libgcc/gthr-posix.h41
5 files changed, 49 insertions, 8 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index dd1dc5504a5..9308090e32c 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,15 @@
+2012-06-11 Sriraman Tallam <tmsriram@google.com>
+
+ * config/i386/libgcc-bsd.ver: Version symbol __cpu_indicator_init.
+ * config/i386/libgcc-sol2.ver: Ditto.
+ * config/i386/libgcc-glibc.ver: Ditto.
+
+2012-06-11 Roland McGrath <mcgrathr@google.com>
+
+ * gthr-posix.h [neither FreeBSD nor Solaris] (__gthread_active_p):
+ If __GLIBC__ is defined, refer to __pthread_key_create instead of
+ pthread_cancel.
+
2012-06-09 Uros Bizjak <ubizjak@gmail.com>
* config/i386/32/sfp-machine.h (__gcc_CMPtype, CMPtype,
diff --git a/libgcc/config/i386/libgcc-bsd.ver b/libgcc/config/i386/libgcc-bsd.ver
index 74622bf7763..0c4b47496bf 100644
--- a/libgcc/config/i386/libgcc-bsd.ver
+++ b/libgcc/config/i386/libgcc-bsd.ver
@@ -109,4 +109,5 @@ GCC_4.6.0 {
GCC_4.8.0 {
__cpu_model
+ __cpu_indicator_init
}
diff --git a/libgcc/config/i386/libgcc-glibc.ver b/libgcc/config/i386/libgcc-glibc.ver
index 07fd1f9c5a7..3bfb0286c29 100644
--- a/libgcc/config/i386/libgcc-glibc.ver
+++ b/libgcc/config/i386/libgcc-glibc.ver
@@ -150,6 +150,7 @@ GCC_4.3.0 {
GCC_4.8.0 {
__cpu_model
+ __cpu_indicator_init
}
%else
GCC_4.4.0 {
@@ -190,5 +191,6 @@ GCC_4.5.0 {
GCC_4.8.0 {
__cpu_model
+ __cpu_indicator_init
}
%endif
diff --git a/libgcc/config/i386/libgcc-sol2.ver b/libgcc/config/i386/libgcc-sol2.ver
index af8a9a0bddb..0aa0499b869 100644
--- a/libgcc/config/i386/libgcc-sol2.ver
+++ b/libgcc/config/i386/libgcc-sol2.ver
@@ -109,4 +109,5 @@ GCC_4.5.0 {
GCC_4.8.0 {
__cpu_model
+ __cpu_indicator_init
}
diff --git a/libgcc/gthr-posix.h b/libgcc/gthr-posix.h
index b5b161184f4..cc4e518f5b9 100644
--- a/libgcc/gthr-posix.h
+++ b/libgcc/gthr-posix.h
@@ -212,18 +212,43 @@ __gthread_active_p (void)
#else /* neither FreeBSD nor Solaris */
+/* For a program to be multi-threaded the only thing that it certainly must
+ be using is pthread_create. However, there may be other libraries that
+ intercept pthread_create with their own definitions to wrap pthreads
+ functionality for some purpose. In those cases, pthread_create being
+ defined might not necessarily mean that libpthread is actually linked
+ in.
+
+ For the GNU C library, we can use a known internal name. This is always
+ available in the ABI, but no other library would define it. That is
+ ideal, since any public pthread function might be intercepted just as
+ pthread_create might be. __pthread_key_create is an "internal"
+ implementation symbol, but it is part of the public exported ABI. Also,
+ it's among the symbols that the static libpthread.a always links in
+ whenever pthread_create is used, so there is no danger of a false
+ negative result in any statically-linked, multi-threaded program.
+
+ For others, we choose pthread_cancel as a function that seems unlikely
+ to be redefined by an interceptor library. The bionic (Android) C
+ library does not provide pthread_cancel, so we do use pthread_create
+ there (and interceptor libraries lose). */
+
+#ifdef __GLIBC__
+__gthrw2(__gthrw_(__pthread_key_create),
+ __pthread_key_create,
+ pthread_key_create)
+# define GTHR_ACTIVE_PROXY __gthrw_(__pthread_key_create)
+#elif defined (__BIONIC__)
+# define GTHR_ACTIVE_PROXY __gthrw_(pthread_create)
+#else
+# define GTHR_ACTIVE_PROXY __gthrw_(pthread_cancel)
+#endif
+
static inline int
__gthread_active_p (void)
{
-/* Android's C library does not provide pthread_cancel, check for
- `pthread_create' instead. */
-#ifndef __BIONIC__
static void *const __gthread_active_ptr
- = __extension__ (void *) &__gthrw_(pthread_cancel);
-#else
- static void *const __gthread_active_ptr
- = __extension__ (void *) &__gthrw_(pthread_create);
-#endif
+ = __extension__ (void *) &GTHR_ACTIVE_PROXY;
return __gthread_active_ptr != 0;
}