]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix copy relocations handling of unique objects.
authorUlrich Drepper <drepper@gmail.com>
Thu, 10 Mar 2011 17:51:33 +0000 (18:51 +0100)
committerPetr Baudis <pasky@suse.cz>
Thu, 26 May 2011 22:18:18 +0000 (00:18 +0200)
(cherry picked from commit 028478fa40d85a73b19638dbe3f83b1acebf370c)

ChangeLog
elf/dl-lookup.c

index c97afec487c7f04885a6858afa5ddb32ff9c5d68..850d3007132e9b980d29a55f8232f9f30e95976c 100644 (file)
--- 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
index 763ec16fa431c2a48166ebd01a9d66bc0ab3d984..0a7b94b2eeb257e56187f701298bebfcc80477d1 100644 (file)
@@ -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;
                        }