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