1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

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.
This commit is contained in:
H.J. Lu
2020-12-05 07:01:58 -08:00
parent 86a4d3fa7d
commit efbbd9c33a
26 changed files with 598 additions and 110 deletions

View File

@ -106,14 +106,24 @@ struct file_entry_new
entries. */
#define DL_CACHE_HWCAP_EXTENSION (1ULL << 62)
/* The number of the ISA level bits in the upper 32 bits of the hwcap
field. */
#define DL_CACHE_HWCAP_ISA_LEVEL_COUNT 10
/* The mask of the ISA level bits in the hwcap field. */
#define DL_CACHE_HWCAP_ISA_LEVEL_MASK \
((1 << DL_CACHE_HWCAP_ISA_LEVEL_COUNT) -1)
/* Return true if the ENTRY->hwcap value indicates that
DL_CACHE_HWCAP_EXTENSION is used. */
static inline bool
dl_cache_hwcap_extension (struct file_entry_new *entry)
{
/* If DL_CACHE_HWCAP_EXTENSION is set, but other bits as well, this
is a different kind of extension. */
return (entry->hwcap >> 32) == (DL_CACHE_HWCAP_EXTENSION >> 32);
/* This is an hwcap extension if only the DL_CACHE_HWCAP_EXTENSION bit
is set, ignoring the lower 32 bits as well as the ISA level bits in
the upper 32 bits. */
return (((entry->hwcap >> 32) & ~DL_CACHE_HWCAP_ISA_LEVEL_MASK)
== (DL_CACHE_HWCAP_EXTENSION >> 32));
}
/* See flags member of struct cache_file_new below. */