diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-03-30 18:45:41 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-03-30 18:45:41 +0000 |
commit | e8e0bee5dd414bb6d5ee7e6a1fa37f330dcb38e4 (patch) | |
tree | 2a22ed2642b6dc5da6474928ca51dfea783d5c5b /sysdeps/generic | |
parent | 001426b8993e21615a756fcabcbead8a62a2125c (diff) | |
download | glibc-e8e0bee5dd414bb6d5ee7e6a1fa37f330dcb38e4.tar.gz glibc-e8e0bee5dd414bb6d5ee7e6a1fa37f330dcb38e4.tar.xz glibc-e8e0bee5dd414bb6d5ee7e6a1fa37f330dcb38e4.zip |
Update.
1998-03-30 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/dl-sysdep.c (_dl_important_hwcaps): New function. * sysdeps/generic/dl-procinfo.h (HWCAP_IMPORTANT): New definition. * sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_hwcap_string): New function. (HWCAP_IMPORTANT): New definition. 1998-03-30 17:26 H.J. Lu <hjl@gnu.org> * elf/dl-open.c (_dl_open): Fix a typo. (_dl_global_scope_alloc): Make it static. * nss/getXXent_r.c (REENTRANT_GETNAME): Avoid endless loop.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/dl-procinfo.h | 3 | ||||
-rw-r--r-- | sysdeps/generic/dl-sysdep.c | 34 |
2 files changed, 34 insertions, 3 deletions
diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h index 801d4b6fa1..48936194ac 100644 --- a/sysdeps/generic/dl-procinfo.h +++ b/sysdeps/generic/dl-procinfo.h @@ -24,4 +24,7 @@ /* We cannot provide a general printing function. */ #define _dl_procinfo(word) -1 +/* By default there is no important hardware capability. */ +#define HWCAP_IMPORTANT (0) + #endif /* dl-procinfo.h */ diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index 8db0c7889f..7f5e32193a 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -45,6 +45,7 @@ int __libc_enable_secure; int __libc_multiple_libcs; /* Defining this here avoids the inclusion of init-first. */ static ElfW(auxv_t) *_dl_auxv; +static unsigned long hwcap; #ifndef DL_FIND_ARG_COMPONENTS @@ -235,10 +236,10 @@ _dl_show_auxv (void) _dl_sysdep_message ("AT_PLATFORM: ", av->a_un.a_ptr, "\n", NULL); break; case AT_HWCAP: - if (_dl_procinfo (av->a_un.a_val) < 0) + hwcap = av->a_un.a_val; + if (_dl_procinfo (hwcap) < 0) _dl_sysdep_message ("AT_HWCAP: ", - _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, - 16, 0), + _itoa_word (hwcap, buf + sizeof buf - 1, 16, 0), "\n", NULL); break; } @@ -269,3 +270,30 @@ _dl_next_ld_env_entry (char ***position) return result; } + +/* Return an array of useful/necessary hardware capability names. */ +char ** +_dl_important_hwcaps (size_t *sz) +{ + /* Determine how many important bits are set. */ + unsigned long int important = hwcap & HWCAP_IMPORTANT; + size_t cnt = 0; + size_t n; + char **result; + + for (n = 0; (~((1UL << n) - 1) & important) != 0; ++n) + if ((important & (1UL << n)) != 0) + ++cnt; + + *sz = 0; + if (cnt == 0) + return NULL; + + result = (char **) malloc (cnt * sizeof (char *)); + if (result != NULL) + for (n = 0; (~((1UL << n) - 1) & important) != 0; ++n) + if ((important & (1UL << n)) != 0) + result[*sz++] = _dl_hwcap_string (n); + + return result; +} |