about summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 680377be0a..477ecdf62e 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -144,7 +144,17 @@ dl_open_worker (void *a)
     }
 
   /* Load the named object.  */
-  args->map = new = _dl_map_object (NULL, file, 0, lt_loaded, 0);
+  args->map = new = _dl_map_object (NULL, file, 0, lt_loaded, 0,
+				    mode & RTLD_NOLOAD);
+
+  /* If the pointer returned is NULL this means the RTLD_NOLOAD flag is
+     set and the object is not already loaded.  */
+  if (new == NULL)
+    {
+      assert (mode & RTLD_NOLOAD);
+      return;
+    }
+
   if (new->l_searchlist.r_list)
     /* It was already open.  */
     return;
@@ -279,6 +289,11 @@ dl_open_worker (void *a)
       /* XXX Do we have to add something to r_dupsearchlist???  --drepper */
     }
 
+  /* Mark the object as not deletable if the RTLD_NODELETE flags was
+     passed.  */
+  if (__builtin_expect (mode & RTLD_NODELETE, 0))
+    new->l_flags_1 |= DF_1_NODELETE;
+
   if (_dl_sysdep_start == NULL)
     /* We must be the static _dl_open in libc.a.  A static program that
        has loaded a dynamic object now has competition.  */