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