[glibc] elf: Fix dl-cache.c build with clang-23

Adhemerval Zanella via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f510065b70db1b9753bf64be687a651dd7b55544

commit f510065b70db1b9753bf64be687a651dd7b55544
Author: Adhemerval Zanella <[email protected]>
Date:   Tue Aug 11 11:27:50 2026 -0300

    elf: Fix dl-cache.c build with clang-23
    
    clang-23 warns that the variable 'ext' set but not used:
    
      dl-cache.c:42:47: error: variable 'ext' set but not used
      [-Werror,-Wunused-but-set-global]
    
    The variable is set unconditionally by _dl_load_cache_lookup, but it
    is only read by glibc_hwcaps_priorities_init (which is compiled only
    for SHARED).

Diff:
---
 elf/dl-cache.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index c6820a9f41..17b174c8b6 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -35,7 +35,9 @@
 static struct cache_file *cache;
 static struct cache_file_new *cache_new;
 static size_t cachesize;
+#ifdef SHARED
 static struct cache_extension_all_loaded ext;
+#endif
 
 static struct {
   typeof ((*(struct __stat64_t64 *)0).st_mtime) mtime;
@@ -540,7 +542,9 @@ _dl_maybe_load_ldsocache (void)
   cache = tmp_cache;
   cache_new = tmp_cache_new;
   cachesize = tmp_cachesize;
+#ifdef SHARED
   ext = tmp_ext;
+#endif
 
   assert (cache != NULL);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.