From e4eb675d0caf19581b69fd41e9fa29ecc7f22d23 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 20 Jun 2007 03:19:13 +0000 Subject: * elf/dl-close.c (free_mem): Free _dl_scope_free_list. 2007-06-13 Jakub Jelinek * include/link.h: Don't include rtld-lowlevel.h. (struct link_map): Remove l_scope_lock. * sysdeps/generic/ldsodefs.h: Don't include rtld-lowlevel.h. (_dl_scope_free_list): New field (variable) in _rtld_global. (DL_LOOKUP_SCOPE_LOCK): Remove. (_dl_scope_free): New prototype. * elf/dl-runtime.c (_dl_fixup): Don't use __rtld_mrlock_*lock. Don't pass DL_LOOKUP_SCOPE_LOCK to _dl_lookup_symbol_x. (_dl_profile_fixup): Likewise. * elf/dl-sym.c (do_sym): Likewise. Use wrapped _dl_lookup_symbol_x whenever !RTLD_SINGLE_THREAD_P, use THREAD_GSCOPE_SET_FLAG and THREAD_GSCOPE_RESET_FLAG around it. * elf/dl-close.c (_dl_close_worker): Don't use __rtld_mrlock_{change,done}. Call _dl_scope_free on the old scope. Make sure THREAD_GSCOPE_WAIT () happens if any old scopes were queued or if l_scope_mem has been abandoned. * elf/dl-open.c (_dl_scope_free): New function. (dl_open_worker): Use it. Don't use __rtld_mrlock_{change,done}. * elf/dl-support.c (_dl_scope_free_list): New variable. * elf/dl-lookup.c (add_dependency): Remove flags argument. Remove DL_LOOKUP_SCOPE_LOCK handling. (_dl_lookup_symbol_x): Adjust caller. Remove DL_LOOKUP_SCOPE_LOCK handling. * elf/dl-object.c (_dl_new_object): Don't use __rtld_mrlock_initialize. 2007-06-19 Ulrich Drepper --- nptl/ChangeLog | 5 ++ nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h | 109 --------------------------- 2 files changed, 5 insertions(+), 109 deletions(-) (limited to 'nptl') diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 87028ca704..12ba85c558 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2007-06-19 Ulrich Drepper + + * sysdeps/unix/sysv/linux/rtld-lowlevel.h: Remove mrlock + implementation. + 2007-06-18 Ulrich Drepper * pthreadP.h: Define PTHREAD_MUTEX_TYPE. diff --git a/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h b/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h index e805b63001..1aeff8fb39 100644 --- a/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h +++ b/nptl/sysdeps/unix/sysv/linux/rtld-lowlevel.h @@ -24,115 +24,6 @@ #include -/* Special multi-reader lock used in ld.so. */ -#define __RTLD_MRLOCK_WRITER 1 -#define __RTLD_MRLOCK_RWAIT 2 -#define __RTLD_MRLOCK_WWAIT 4 -#define __RTLD_MRLOCK_RBITS \ - ~(__RTLD_MRLOCK_WRITER | __RTLD_MRLOCK_RWAIT | __RTLD_MRLOCK_WWAIT) -#define __RTLD_MRLOCK_INC 8 -#define __RTLD_MRLOCK_TRIES 5 - - -typedef int __rtld_mrlock_t; - - -#define __rtld_mrlock_define(CLASS,NAME) \ - CLASS __rtld_mrlock_t NAME; - - -#define _RTLD_MRLOCK_INITIALIZER 0 -#define __rtld_mrlock_initialize(NAME) \ - (void) ((NAME) = 0) - - -#define __rtld_mrlock_lock(lock) \ - do { \ - __label__ out; \ - while (1) \ - { \ - int oldval; \ - for (int tries = 0; tries < __RTLD_MRLOCK_TRIES; ++tries) \ - { \ - oldval = lock; \ - while (__builtin_expect ((oldval \ - & (__RTLD_MRLOCK_WRITER \ - | __RTLD_MRLOCK_WWAIT)) \ - == 0, 1)) \ - { \ - int newval = ((oldval & __RTLD_MRLOCK_RBITS) \ - + __RTLD_MRLOCK_INC); \ - int ret = atomic_compare_and_exchange_val_acq (&(lock), \ - newval, \ - oldval); \ - if (__builtin_expect (ret == oldval, 1)) \ - goto out; \ - oldval = ret; \ - } \ - atomic_delay (); \ - } \ - if ((oldval & __RTLD_MRLOCK_RWAIT) == 0) \ - { \ - atomic_or (&(lock), __RTLD_MRLOCK_RWAIT); \ - oldval |= __RTLD_MRLOCK_RWAIT; \ - } \ - lll_private_futex_wait (lock, oldval); \ - } \ - out:; \ - } while (0) - - -#define __rtld_mrlock_unlock(lock) \ - do { \ - int oldval = atomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_INC); \ - if (__builtin_expect ((oldval \ - & (__RTLD_MRLOCK_RBITS | __RTLD_MRLOCK_WWAIT)) \ - == (__RTLD_MRLOCK_INC | __RTLD_MRLOCK_WWAIT), 0)) \ - /* We have to wake all threads since there might be some queued \ - readers already. */ \ - lll_private_futex_wake (&(lock), 0x7fffffff); \ - } while (0) - - -/* There can only ever be one thread trying to get the exclusive lock. */ -#define __rtld_mrlock_change(lock) \ - do { \ - __label__ out; \ - while (1) \ - { \ - int oldval; \ - for (int tries = 0; tries < __RTLD_MRLOCK_TRIES; ++tries) \ - { \ - oldval = lock; \ - while (__builtin_expect ((oldval & __RTLD_MRLOCK_RBITS) == 0, 1)) \ - { \ - int newval = ((oldval & __RTLD_MRLOCK_RWAIT) \ - + __RTLD_MRLOCK_WRITER); \ - int ret = atomic_compare_and_exchange_val_acq (&(lock), \ - newval, \ - oldval); \ - if (__builtin_expect (ret == oldval, 1)) \ - goto out; \ - oldval = ret; \ - } \ - atomic_delay (); \ - } \ - atomic_or (&(lock), __RTLD_MRLOCK_WWAIT); \ - oldval |= __RTLD_MRLOCK_WWAIT; \ - lll_private_futex_wait (lock, oldval); \ - } \ - out:; \ - } while (0) - - -#define __rtld_mrlock_done(lock) \ - do { \ - int oldval = atomic_exchange_and_add (&(lock), -__RTLD_MRLOCK_WRITER); \ - if (__builtin_expect ((oldval & __RTLD_MRLOCK_RWAIT) != 0, 0)) \ - lll_private_futex_wake (&(lock), 0x7fffffff); \ - } while (0) - - /* Function to wait for variable become zero. Used in ld.so for reference counters. */ #define __rtld_waitzero(word) \ -- cgit 1.4.1