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