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

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Aug 12 18:21:15 GMT 2026


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).
---
 elf/dl-cache.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index c6820a9f414..17b174c8b60 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);
 }
-- 
2.53.0



More information about the Libc-alpha mailing list