From 13cb6162f659446cb7bdb0a6c3cf1d9efe8218f1 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 25 Nov 2015 00:47:38 +0100 Subject: Simplify __libc_lock_owner_self by simply using the TCB instead of introducing another TLS variable, whose access might need locking, and thus __libc_lock_owner_self... --- sysdeps/mach/hurd/Versions | 4 ++-- sysdeps/mach/hurd/bits/libc-lock.h | 6 +----- sysdeps/mach/hurd/cthreads.c | 13 ------------- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/sysdeps/mach/hurd/Versions b/sysdeps/mach/hurd/Versions index f760a80401..7cab8e8551 100644 --- a/sysdeps/mach/hurd/Versions +++ b/sysdeps/mach/hurd/Versions @@ -6,7 +6,7 @@ libc { GLIBC_PRIVATE { # Functions shared with the dynamic linker __libc_read; __libc_write; __libc_lseek64; - __libc_lock_self0; __libc_get_lock_self; + __libc_lock_self0; _dl_init_first; } @@ -32,6 +32,6 @@ ld { # functions that must be shared with libc __libc_read; __libc_write; __libc_lseek64; - __libc_lock_self0; __libc_get_lock_self; + __libc_lock_self0; } } diff --git a/sysdeps/mach/hurd/bits/libc-lock.h b/sysdeps/mach/hurd/bits/libc-lock.h index a0f83728e4..b8b7bec8bf 100644 --- a/sysdeps/mach/hurd/bits/libc-lock.h +++ b/sysdeps/mach/hurd/bits/libc-lock.h @@ -35,11 +35,7 @@ typedef struct typedef __libc_lock_recursive_t __rtld_lock_recursive_t; 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()) +#define __libc_lock_owner_self() (__LIBC_NO_TLS() ? &__libc_lock_self0 : THREAD_SELF) #else typedef struct __libc_lock_opaque__ __libc_lock_t; diff --git a/sysdeps/mach/hurd/cthreads.c b/sysdeps/mach/hurd/cthreads.c index b309301d93..e25fcd0962 100644 --- a/sysdeps/mach/hurd/cthreads.c +++ b/sysdeps/mach/hurd/cthreads.c @@ -20,19 +20,6 @@ #include char __libc_lock_self0[0]; -#if IS_IN (rtld) -/* We don't support static tls relocation so early, but we do not have threads - there either anyway. */ -static char __libc_lock_self[0]; -#else -static __thread char __libc_lock_self[0]; -#endif - -void * -__libc_get_lock_self(void) -{ - return (void*) &__libc_lock_self; -} /* Placeholder for key creation routine from Hurd cthreads library. */ int -- cgit v1.2.3