aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-03-10 18:51:33 +0100
committerPetr Baudis <pasky@suse.cz>2011-05-27 00:18:18 +0200
commit411a9d6b1de462394aabd2a5bf920fde140249ff (patch)
tree4434a83a9ec003b1732419ea8716fdd200cada4b
parent957a75e60be98088738b5b5640164e8dfffc4f4e (diff)
downloadglibc-411a9d6b1de462394aabd2a5bf920fde140249ff.tar
glibc-411a9d6b1de462394aabd2a5bf920fde140249ff.tar.gz
glibc-411a9d6b1de462394aabd2a5bf920fde140249ff.tar.bz2
glibc-411a9d6b1de462394aabd2a5bf920fde140249ff.zip
Fix copy relocations handling of unique objects.
(cherry picked from commit 028478fa40d85a73b19638dbe3f83b1acebf370c)
-rw-r--r--ChangeLog8
-rw-r--r--elf/dl-lookup.c17
2 files changed, 22 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c97afec487..850d300713 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-03-10 Ulrich Drepper <drepper@gmail.com>
+
+ [BZ #12510]
+ * elf/dl-lookup.c (do_lookup_x): For copy relocations of unique objects
+ copy from the symbol referenced in the relocation to initialize the
+ used variable.
+ Patch by Piotr Bury <pbury@goahead.com>.
+
2011-03-06 Ulrich Drepper <drepper@gmail.com>
* elf/dl-load.c (_dl_map_object): If we are looking for the first
diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c
index 763ec16fa4..0a7b94b2ee 100644
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -1,5 +1,5 @@
/* Look up a symbol in the loaded objects.
- Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-2007, 2009, 2011 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
@@ -363,8 +363,19 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
if (entries[idx].hashval == new_hash
&& strcmp (entries[idx].name, undef_name) == 0)
{
- result->s = entries[idx].sym;
- result->m = (struct link_map *) entries[idx].map;
+ if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
+ {
+ /* We possibly have to initialize the central
+ copy from the copy addressed through the
+ relocation. */
+ result->s = sym;
+ result->m = (struct link_map *) map;
+ }
+ else
+ {
+ result->s = entries[idx].sym;
+ result->m = (struct link_map *) entries[idx].map;
+ }
__rtld_lock_unlock_recursive (tab->lock);
return 1;
}