[glibc] elf: Remove _dl_unload_cache

Adhemerval Zanella via Glibc-cvs <[email protected]> Mon, 13 Jul 2026 16:56:31 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=098e6c969ca6dba9da2e7bbde131c9e78756e50a

commit 098e6c969ca6dba9da2e7bbde131c9e78756e50a
Author: Adhemerval Zanella <[email protected]>
Date:   Mon Jul 6 16:36:49 2026 -0300

    elf: Remove _dl_unload_cache
    
    It is a no-op since b9957a70b82.
    
    Reviewed-by: DJ Delorie <[email protected]>

Diff:
---
 elf/dl-cache.c             | 13 -------------
 elf/dl-open.c              |  5 -----
 elf/rtld.c                 |  5 -----
 sysdeps/generic/ldsodefs.h |  6 ------
 4 files changed, 29 deletions(-)

diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 03bcd5bd06..c6820a9f41 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -606,19 +606,6 @@ _dl_load_cache_lookup (const char *name)
   return result;
 }
 
-#ifndef MAP_COPY
-/* If the system does not support MAP_COPY we cannot leave the file open
-   all the time since this would create problems when the file is replaced.
-   Therefore we provide this function to close the file and open it again
-   once needed.  */
-void
-_dl_unload_cache (void)
-{
-  /* Functionality is no longer needed, but kept for internal ABI for
-     now.  */
-}
-#endif
-
 const struct tunable_header_cached *
 _dl_load_cache_tunables (const char **data)
 {
diff --git a/elf/dl-open.c b/elf/dl-open.c
index cf4749694f..87fcee8b02 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -898,11 +898,6 @@ no more namespaces available for dlmopen()"));
   struct dl_exception exception;
   int errcode = _dl_catch_exception (&exception, dl_open_worker, &args);
 
-#if defined USE_LDCONFIG && !defined MAP_COPY
-  /* We must unmap the cache file.  */
-  _dl_unload_cache ();
-#endif
-
   /* Do this for both the error and success cases.  The old value has
      only been determined if the namespace ID was assigned (i.e., it
      is not __LM_ID_CALLER).  In the success case, we actually may
diff --git a/elf/rtld.c b/elf/rtld.c
index e5ba71fef1..fc053df858 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2371,11 +2371,6 @@ dl_main (const ElfW(Phdr) *phdr,
   /* Auditing checkpoint: we have added all objects.  */
   _dl_audit_activity_nsid (LM_ID_BASE, LA_ACT_CONSISTENT);
 
-#if defined USE_LDCONFIG && !defined MAP_COPY
-  /* We must munmap() the cache file.  */
-  _dl_unload_cache ();
-#endif
-
   /* Once we return, _dl_sysdep_start will invoke
      the DT_INIT functions and then *USER_ENTRY.  */
 }
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index f94247ad9f..c0deb11c02 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -1151,12 +1151,6 @@ const struct r_strlenpair *_dl_important_hwcaps (const char *prepend,
    or null if none is found.  Caller must free returned string.  */
 extern char *_dl_load_cache_lookup (const char *name) attribute_hidden;
 
-/* If the system does not support MAP_COPY we cannot leave the file open
-   all the time since this would create problems when the file is replaced.
-   Therefore we provide this function to close the file and open it again
-   once needed.  */
-extern void _dl_unload_cache (void) attribute_hidden;
-
 /* System-dependent function to read a file's whole contents in the
    most convenient manner available.  *SIZEP gets the size of the
    file.  On error MAP_FAILED is returned.  */