diff options
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/dl-cache.c | 21 | ||||
-rw-r--r-- | sysdeps/generic/dl-procinfo.h | 8 |
2 files changed, 26 insertions, 3 deletions
diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 8206171f94..4ece370f27 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -22,7 +22,9 @@ #include <ldsodefs.h> #include <sys/mman.h> #include <dl-cache.h> +#include <dl-procinfo.h> +#include <stdio-common/_itoa.h> /* System-dependent function to read a file's whole contents in the most convenient manner available. */ @@ -30,6 +32,8 @@ extern void *_dl_sysdep_read_whole_file (const char *filename, size_t *filesize_ptr, int mmap_prot); +extern const char *_dl_platform; + /* This is the starting address and the size of the mmap()ed file. */ static struct cache_file *cache; static struct cache_file_new *cache_new; @@ -209,6 +213,7 @@ _dl_load_cache_lookup (const char *name) { /* This file ends in static libraries where we don't have a hwcap. */ unsigned long int *hwcap; + uint64_t platform; weak_extern (_dl_hwcap); /* This is where the strings start. */ @@ -218,9 +223,19 @@ _dl_load_cache_lookup (const char *name) cache_data_size = (const char *) cache + cachesize - cache_data; hwcap = &_dl_hwcap; - -#define HWCAP_CHECK \ - if (hwcap && (cache_new->libs[middle].hwcap & *hwcap) > *hwcap) \ + platform = _dl_string_platform (_dl_platform); + if (platform != -1) + platform = 1ULL << platform; + + /* Only accept hwcap if it's for the right platform. */ +#define HWCAP_CHECK \ + if (_DL_PLATFORMS_COUNT && platform != -1 \ + && (cache_new->libs[middle].hwcap & _DL_HWCAP_PLATFORM) != 0 \ + && (cache_new->libs[middle].hwcap & _DL_HWCAP_PLATFORM) != platform) \ + continue; \ + if (hwcap \ + && ((cache_new->libs[middle].hwcap & *hwcap & ~_DL_HWCAP_PLATFORM) \ + > *hwcap)) \ continue SEARCH_CACHE (cache_new); } diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h index 180a08b7c2..902eddd559 100644 --- a/sysdeps/generic/dl-procinfo.h +++ b/sysdeps/generic/dl-procinfo.h @@ -27,12 +27,20 @@ /* There are no hardware capabilities defined. */ #define _dl_hwcap_string(idx) "" +/* There are no different platforms defined. */ +#define _dl_platform_string(idx) "" + /* By default there is no important hardware capability. */ #define HWCAP_IMPORTANT (0) +/* There're no platforms to filter out. */ +#define _DL_HWCAP_PLATFORM 0 + /* We don't have any hardware capabilities. */ #define _DL_HWCAP_COUNT 0 #define _dl_string_hwcap(str) (-1) +#define _dl_string_platform(str) (-1) + #endif /* dl-procinfo.h */ |