[PATCH v4 5/9] elf: Use RTLD_NODELETE for dependencies

Adhemerval Zanella adhemerval.zanella@linaro.org
Fri Dec 6 17:37:53 GMT 2024


So dlopen dependencies for objects opened with RTLD_NODELETE
are also marked with RTLD_NODELETE.

Checked on x86_64-linux-gnu.
---
 elf/dl-open.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/elf/dl-open.c b/elf/dl-open.c
index ba3c266e6a..f283a87144 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -604,7 +604,8 @@ dl_open_worker_begin (void *a)
 
   /* Load that object's dependencies.  */
   _dl_map_object_deps (new, NULL, 0, 0,
-		       mode & (__RTLD_DLOPEN | RTLD_DEEPBIND | __RTLD_AUDIT));
+		       mode & (__RTLD_DLOPEN | RTLD_DEEPBIND | __RTLD_AUDIT
+			       | RTLD_NODELETE));
 
   /* So far, so good.  Now check the versions.  */
   for (unsigned int i = 0; i < new->l_searchlist.r_nlist; ++i)
-- 
2.43.0



More information about the Libc-alpha mailing list