djdelorie / rpms / glibc

Forked from rpms/glibc 3 years ago
Clone
a5ececf
commit fcb04b9aed26a737159ef7be9c5a6ad0994437dc
a5ececf
Author: Florian Weimer <fweimer@redhat.com>
a5ececf
Date:   Thu Oct 31 13:28:49 2019 +0100
a5ececf
a5ececf
    Introduce DL_LOOKUP_FOR_RELOCATE flag for _dl_lookup_symbol_x
a5ececf
    
a5ececf
    This will allow changes in dependency processing during non-lazy
a5ececf
    binding, for more precise processing of NODELETE objects: During
a5ececf
    initial relocation in dlopen, the fate of NODELETE objects is still
a5ececf
    unclear, so objects which are depended upon by NODELETE objects
a5ececf
    cannot immediately be marked as NODELETE.
a5ececf
    
a5ececf
    Change-Id: Ic7b94a3f7c4719a00ca8e6018088567824da0658
a5ececf
a5ececf
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
a5ececf
index e7fb8da276094fc5..245f5ac49c1a9eea 100644
a5ececf
--- a/elf/dl-reloc.c
a5ececf
+++ b/elf/dl-reloc.c
a5ececf
@@ -244,7 +244,8 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
a5ececf
 	       v = (version);						      \
a5ececf
 	     _lr = _dl_lookup_symbol_x (strtab + (*ref)->st_name, l, (ref),   \
a5ececf
 					scope, v, _tc,			      \
a5ececf
-					DL_LOOKUP_ADD_DEPENDENCY, NULL);      \
a5ececf
+					DL_LOOKUP_ADD_DEPENDENCY	      \
a5ececf
+					| DL_LOOKUP_FOR_RELOCATE, NULL);      \
a5ececf
 	     l->l_lookup_cache.ret = (*ref);				      \
a5ececf
 	     l->l_lookup_cache.value = _lr; }))				      \
a5ececf
      : l)
a5ececf
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
a5ececf
index 42c2f0c4241ae1ed..445605ad9c67fa52 100644
a5ececf
--- a/sysdeps/generic/ldsodefs.h
a5ececf
+++ b/sysdeps/generic/ldsodefs.h
a5ececf
@@ -899,6 +899,9 @@ enum
a5ececf
     DL_LOOKUP_RETURN_NEWEST = 2,
a5ececf
     /* Set if dl_lookup* called with GSCOPE lock held.  */
a5ececf
     DL_LOOKUP_GSCOPE_LOCK = 4,
a5ececf
+    /* Set if dl_lookup is called for non-lazy relocation processing
a5ececf
+       from _dl_relocate_object in elf/dl-reloc.c.  */
a5ececf
+    DL_LOOKUP_FOR_RELOCATE = 8,
a5ececf
   };
a5ececf
 
a5ececf
 /* Lookup versioned symbol.  */