about summary refs log tree commit diff
path: root/elf/dl-cache.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-12-05 07:01:58 -0800
committerH.J. Lu <hjl.tools@gmail.com>2021-01-13 05:51:17 -0800
commitefbbd9c33adfa843d65860b1b02adebb8ecb57ce (patch)
tree79c61c55698036fc99ec936ea400c7a9975eef28 /elf/dl-cache.c
parent86a4d3fa7d1bda3c02cf713cf289d6f893970117 (diff)
downloadglibc-efbbd9c33adfa843d65860b1b02adebb8ecb57ce.tar.gz
glibc-efbbd9c33adfa843d65860b1b02adebb8ecb57ce.tar.xz
glibc-efbbd9c33adfa843d65860b1b02adebb8ecb57ce.zip
ldconfig/x86: Store ISA level in cache and aux cache
Store ISA level in the portion of the unused upper 32 bits of the hwcaps
field in cache and the unused pad field in aux cache.  ISA level is stored
and checked only for shared objects in glibc-hwcaps subdirectories.  The
shared objects in the default directories aren't checked since there are
no fallbacks for these shared objects.

Tested on x86-64-v2, x86-64-v3 and x86-64-v4 machines with
--disable-hardcoded-path-in-tests and --enable-hardcoded-path-in-tests.
Diffstat (limited to 'elf/dl-cache.c')
-rw-r--r--elf/dl-cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 935e3a60b4..32f3bef5ea 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -25,6 +25,7 @@
 #include <stdint.h>
 #include <_itoa.h>
 #include <dl-hwcaps.h>
+#include <dl-isa-level.h>
 
 #ifndef _DL_PLATFORMS_COUNT
 # define _DL_PLATFORMS_COUNT 0
@@ -284,6 +285,9 @@ search_cache (const char *string_table, uint32_t string_table_size,
 
 #ifdef SHARED
 			  named_hwcap = dl_cache_hwcap_extension (libnew);
+			  if (named_hwcap
+			      && !dl_cache_hwcap_isa_level_compatible (libnew))
+			    continue;
 #endif
 
 			  /* The entries with named/extension hwcaps