aba491
commit b893410be304ddcea0bd43f537a13e8b18d37cf2
aba491
Author: Florian Weimer <fweimer@redhat.com>
aba491
Date:   Mon Nov 27 11:28:07 2023 +0100
aba491
aba491
    elf: In _dl_relocate_object, skip processing if object is relocated
aba491
    
aba491
    This is just a minor optimization.  It also makes it more obvious that
aba491
    _dl_relocate_object can be called multiple times.
aba491
    
aba491
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
aba491
aba491
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
aba491
index 7d8b2bd2336eecb6..66c9266d7f9d65af 100644
aba491
--- a/elf/dl-reloc.c
aba491
+++ b/elf/dl-reloc.c
aba491
@@ -165,6 +165,9 @@ void
aba491
 _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
aba491
 		     int reloc_mode, int consider_profiling)
aba491
 {
aba491
+  if (l->l_relocated)
aba491
+    return;
aba491
+
aba491
   struct textrels
aba491
   {
aba491
     caddr_t start;
aba491
@@ -202,9 +205,6 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
aba491
 # define consider_symbind 0
aba491
 #endif
aba491
 
aba491
-  if (l->l_relocated)
aba491
-    return;
aba491
-
aba491
   /* If DT_BIND_NOW is set relocate all references in this object.  We
aba491
      do not do this if we are profiling, of course.  */
aba491
   // XXX Correct for auditing?