diff options
author | Andreas Jaeger <aj@suse.de> | 2000-11-15 08:46:30 +0000 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2000-11-15 08:46:30 +0000 |
commit | a6c1c03a440ec55e427844ba851eed1ea2c95c95 (patch) | |
tree | fd63a016f9ad7a0bbd35a3848864560ce11fa9bd /sysdeps | |
parent | ad1a5cc746c507ddd9b31cae653aefe3fac7a249 (diff) | |
download | glibc-a6c1c03a440ec55e427844ba851eed1ea2c95c95.tar.gz glibc-a6c1c03a440ec55e427844ba851eed1ea2c95c95.tar.xz glibc-a6c1c03a440ec55e427844ba851eed1ea2c95c95.zip |
Update.
2000-11-15 Andreas Jaeger <aj@suse.de> * elf/cache.c (struct cache_entry): Use uint64_t for hwcap. (print_entry): Likewise. (add_to_cache): Likewise. * elf/ldconfig.h (add_to_cache): Change prototype for hwcap change. * elf/ldconfig.c (struct lib_entry): Use uint64_t for hwcap. (path_hwcap): Likewise. (search_dir): Likewise. * sysdeps/generic/dl-cache.c (HWCAP_CHECK): Handle platform. * elf/cache.c (add_to_cache): Handle 64 bit hwcap entry. * sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h (_dl_platform_string): New. (_DL_HWCAP_PLATFORM): New. (_dl_string_platform): New. * sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h: Likewise. * sysdeps/generic/dl-procinfo.h (_DL_HWCAP_COUNT): New. (_dl_string_platform): New. (_DL_HWCAP_PLATFORM): New. (_dl_platform_string): New. * sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Added x86 platform recognition. (_DL_HWCAP_COUNT): New. (_dl_string_platform): New. (_DL_HWCAP_PLATFORM): New. (_dl_platform_string): New.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/dl-cache.c | 21 | ||||
-rw-r--r-- | sysdeps/generic/dl-procinfo.h | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/dl-procinfo.h | 36 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h | 8 |
5 files changed, 78 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 */ diff --git a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h index c4a4e324e6..55bd830011 100644 --- a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h @@ -32,6 +32,18 @@ static const char x86_cap_flags[][7] = }; #define _DL_HWCAP_COUNT 32 +static const char x86_platforms[][5] = + { + "i386", "i486", "i586", "i686" + }; +#define _DL_PLATFORMS_COUNT 4 + +/* Start at 48 to reserve some space. */ +#define _DL_FIRST_PLATFORM 48 +/* Mask to filter out platforms. */ +#define _DL_HWCAP_PLATFORM (7ULL << _DL_FIRST_PLATFORM) + + static inline int __attribute__ ((unused)) _dl_procinfo (int word) @@ -58,6 +70,13 @@ _dl_hwcap_string (int idx) return x86_cap_flags[idx]; }; +static inline const char * +__attribute__ ((unused)) +_dl_platform_string (int idx) +{ + return x86_platforms [idx - _DL_FIRST_PLATFORM]; +}; + enum { HWCAP_I386_FPU = 1 << 0, @@ -82,6 +101,7 @@ enum /* XXX Which others to add here? */ HWCAP_IMPORTANT = (HWCAP_I386_MMX) + }; static inline int @@ -98,4 +118,20 @@ _dl_string_hwcap (const char *str) return -1; }; + +static inline int +__attribute__ ((unused)) +_dl_string_platform (const char *str) +{ + int i; + + if (str != NULL) + for (i = 0; i < _DL_PLATFORMS_COUNT; ++i) + { + if (strcmp (str, x86_platforms[i]) == 0) + return _DL_FIRST_PLATFORM + i; + } + return -1; +}; + #endif /* dl-procinfo.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h b/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h index 8a825a64c5..adfe4be05c 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/dl-procinfo.h @@ -68,4 +68,12 @@ _dl_string_hwcap (const char *str) #define HWCAP_IMPORTANT (HWCAP_SPARC_V9) +/* There are no different platforms defined. */ +#define _dl_platform_string(idx) "" + +/* There're no platforms to filter out. */ +#define _DL_HWCAP_PLATFORM 0 + +#define _dl_string_platform(str) (-1) + #endif /* dl-procinfo.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h index 7825937733..78bd5c883c 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/dl-procinfo.h @@ -69,4 +69,12 @@ _dl_string_hwcap (const char *str) #define HWCAP_IMPORTANT (0) +/* There are no different platforms defined. */ +#define _dl_platform_string(idx) "" + +/* There're no platforms to filter out. */ +#define _DL_HWCAP_PLATFORM 0 + +#define _dl_string_platform(str) (-1) + #endif /* dl-procinfo.h */ |