about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-11-27 11:28:07 +0100
committerFlorian Weimer <fweimer@redhat.com>2023-11-27 11:28:07 +0100
commitb893410be304ddcea0bd43f537a13e8b18d37cf2 (patch)
tree1bfcbb7155b90560620618752275a0b12e493636 /elf
parent2e0c0ff95ca0e3122eb5b906ee26a31f284ce5ab (diff)
downloadglibc-b893410be304ddcea0bd43f537a13e8b18d37cf2.tar.gz
glibc-b893410be304ddcea0bd43f537a13e8b18d37cf2.tar.xz
glibc-b893410be304ddcea0bd43f537a13e8b18d37cf2.zip
elf: In _dl_relocate_object, skip processing if object is relocated
This is just a minor optimization.  It also makes it more obvious that
_dl_relocate_object can be called multiple times.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-reloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/elf/dl-reloc.c b/elf/dl-reloc.c
index e5c555d82c..72c8586d29 100644
--- a/elf/dl-reloc.c
+++ b/elf/dl-reloc.c
@@ -205,6 +205,9 @@ void
 _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 		     int reloc_mode, int consider_profiling)
 {
+  if (l->l_relocated)
+    return;
+
   struct textrels
   {
     caddr_t start;
@@ -242,9 +245,6 @@ _dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[],
 # define consider_symbind 0
 #endif
 
-  if (l->l_relocated)
-    return;
-
   /* If DT_BIND_NOW is set relocate all references in this object.  We
      do not do this if we are profiling, of course.  */
   // XXX Correct for auditing?