diff mbox series

[05/14] split do_reloc_2() out of do_open_worker()

Message ID 20230518082854.3903342-6-stsp2@yandex.ru
State New
Headers show
Series implement RTLD_NORELOCATE api [BZ #30007] | expand

Commit Message

stsp May 18, 2023, 8:28 a.m. UTC
This is mostly a mechanical split with no functional changes intended.

The test-suite was run on x86_64/64 and showed no regressions.

Signed-off-by: Stas Sergeev <stsp2@yandex.ru>
---
 elf/dl-open.c | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/elf/dl-open.c b/elf/dl-open.c
index a77a6143e2..687a393e0d 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -644,6 +644,28 @@  do_reloc_1 (struct link_map *new, int mode, Lmid_t nsid, bool call_ctors)
     }
 }
 
+static void
+do_reloc_2 (struct link_map *new, int mode, struct dl_open_args *args)
+{
+  /* Run the initializer functions of new objects.  Temporarily
+     disable the exception handler, so that lazy binding failures are
+     fatal.  */
+  {
+    struct dl_init_args init_args =
+      {
+        .new = new,
+        .argc = args->argc,
+        .argv = args->argv,
+        .env = args->env
+      };
+    _dl_catch_exception (NULL, call_dl_init, &init_args);
+  }
+
+  /* Now we can make the new map available in the global scope.  */
+  if (mode & RTLD_GLOBAL)
+    add_to_global_update (new);
+}
+
 static void
 dl_open_worker_begin (void *a)
 {
@@ -801,23 +823,7 @@  dl_open_worker (void *a)
   int mode = args->mode;
   struct link_map *new = args->map;
 
-  /* Run the initializer functions of new objects.  Temporarily
-     disable the exception handler, so that lazy binding failures are
-     fatal.  */
-  {
-    struct dl_init_args init_args =
-      {
-        .new = new,
-        .argc = args->argc,
-        .argv = args->argv,
-        .env = args->env
-      };
-    _dl_catch_exception (NULL, call_dl_init, &init_args);
-  }
-
-  /* Now we can make the new map available in the global scope.  */
-  if (mode & RTLD_GLOBAL)
-    add_to_global_update (new);
+  do_reloc_2 (new, mode, args);
 
   /* Let the user know about the opencount.  */
   if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_FILES))