summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/bits/libc-lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/bits/libc-lock.h')
-rw-r--r--sysdeps/mach/hurd/bits/libc-lock.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/bits/libc-lock.h b/sysdeps/mach/hurd/bits/libc-lock.h
index 28c69fa0b4..cc4afb1507 100644
--- a/sysdeps/mach/hurd/bits/libc-lock.h
+++ b/sysdeps/mach/hurd/bits/libc-lock.h
@@ -20,8 +20,10 @@
#define _BITS_LIBC_LOCK_H 1
#if (_LIBC - 0) || (_CTHREADS_ - 0)
+# if (_LIBC - 0)
+# include <tls.h>
+# endif
#include <cthreads.h>
-#include <hurd/threadvar.h>
typedef struct mutex __libc_lock_t;
typedef struct
@@ -32,7 +34,12 @@ typedef struct
} __libc_lock_recursive_t;
typedef __libc_lock_recursive_t __rtld_lock_recursive_t;
-#define __libc_lock_owner_self() ((void *) __hurd_threadvar_location (0))
+extern char __libc_lock_self0[0];
+/* We have to hide the __libc_lock_self access behind a function call,
+ otherwise gcc >= 4.9 would try to prefetch the TLS dereference even before
+ the __LIBC_NO_TLS test is finished... */
+extern void *__libc_get_lock_self(void);
+#define __libc_lock_owner_self() (__LIBC_NO_TLS() ? &__libc_lock_self0 : __libc_get_lock_self())
#else
typedef struct __libc_lock_opaque__ __libc_lock_t;
@@ -203,4 +210,10 @@ void *__libc_getspecific (__libc_key_t key);
#endif /* _CTHREADS_ */
+/* Hide the definitions which are only supposed to be used inside libc in
+ a separate file. This file is not present in the installation! */
+#ifdef _LIBC
+# include <bits/libc-lockP.h>
+#endif
+
#endif /* bits/libc-lock.h */