summaryrefslogtreecommitdiff
path: root/libc/elf/dl-runtime.c
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2006-10-18 15:30:11 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2006-10-18 15:30:11 +0000
commit0048423cf450ec8a7ab725bc43a0f4a0372c1737 (patch)
tree6992e095eb10e356ba84c291523174a264e87407 /libc/elf/dl-runtime.c
parentb0c556f461de6418fb565a208c1b290026b4f355 (diff)
Merge changes between r345 and r426 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@427 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/elf/dl-runtime.c')
-rw-r--r--libc/elf/dl-runtime.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/libc/elf/dl-runtime.c b/libc/elf/dl-runtime.c
index f92cbe26b..05fd974bf 100644
--- a/libc/elf/dl-runtime.c
+++ b/libc/elf/dl-runtime.c
@@ -1,5 +1,5 @@
/* On-demand PLT fixup for shared objects.
- Copyright (C) 1995-2002,2003,2004,2005 Free Software Foundation, Inc.
+ Copyright (C) 1995-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -92,16 +92,36 @@ _dl_fixup (
version = NULL;
}
+ struct r_scoperec *scoperec = l->l_scoperec;
+ if (l->l_type == lt_loaded)
+ {
+ __rtld_mrlock_lock (l->l_scoperec_lock);
+ scoperec = l->l_scoperec;
+ catomic_increment (&scoperec->nusers);
+ __rtld_mrlock_unlock (l->l_scoperec_lock);
+ }
+
result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym,
- l->l_scope, version, ELF_RTYPE_CLASS_PLT,
+ scoperec->scope, version,
+ ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
+ if (l->l_type == lt_loaded
+ && catomic_decrement_val (&scoperec->nusers) == 0
+ && __builtin_expect (scoperec->remove_after_use, 0))
+ {
+ if (scoperec->notify)
+ __rtld_notify (scoperec->nusers);
+ else
+ free (scoperec);
+ }
+
/* Currently result contains the base load address (or link map)
of the object that defines sym. Now add in the symbol
offset. */
value = DL_FIXUP_MAKE_VALUE (result,
- sym ? LOOKUP_VALUE_ADDRESS (result)
- + sym->st_value : 0);
+ sym ? (LOOKUP_VALUE_ADDRESS (result)
+ + sym->st_value) : 0);
}
else
{
@@ -174,11 +194,30 @@ _dl_profile_fixup (
version = NULL;
}
+ struct r_scoperec *scoperec = l->l_scoperec;
+ if (l->l_type == lt_loaded)
+ {
+ __rtld_mrlock_lock (l->l_scoperec_lock);
+ scoperec = l->l_scoperec;
+ catomic_increment (&scoperec->nusers);
+ __rtld_mrlock_unlock (l->l_scoperec_lock);
+ }
+
result = _dl_lookup_symbol_x (strtab + refsym->st_name, l, &defsym,
- l->l_scope, version,
+ scoperec->scope, version,
ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, NULL);
+ if (l->l_type == lt_loaded
+ && catomic_decrement_val (&scoperec->nusers) == 0
+ && __builtin_expect (scoperec->remove_after_use, 0))
+ {
+ if (scoperec->notify)
+ __rtld_notify (scoperec->nusers);
+ else
+ free (scoperec);
+ }
+
/* Currently result contains the base load address (or link map)
of the object that defines sym. Now add in the symbol
offset. */