diff options
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | elf/dl-open.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/dl-procinfo.h | 3 | ||||
-rw-r--r-- | sysdeps/generic/dl-sysdep.c | 34 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/dl-procinfo.h | 29 |
5 files changed, 77 insertions, 15 deletions
@@ -1,3 +1,19 @@ +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. + 1998-03-30 17:20 Ulrich Drepper <drepper@cygnus.com> * Makerules: Remove duplicate rules to handle stamp.oS. @@ -158,6 +174,8 @@ * setjmp/tst-setjmp.c: Don't test __setjmp, test _setjmp instead. + * nss/getXXent_r.c (REENTRANT_GETNAME): Avoid endless loop. + 1998-03-29 02:02 H.J. Lu <hjl@gnu.org> * sysdeps/i386/i486/bits/string.h: Fix typos. diff --git a/elf/dl-open.c b/elf/dl-open.c index 4bec833..99fac81 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -37,7 +37,7 @@ extern char **__libc_argv; extern char **__environ; -size_t _dl_global_scope_alloc; +static size_t _dl_global_scope_alloc; /* During the program run we must not modify the global data of @@ -121,7 +121,8 @@ _dl_open (const char *file, int mode) { /* This is the first dynamic object given global scope. */ _dl_global_scope_alloc = 8; - _dl_global_scope = malloc (8 * sizeof (struct link_map *)); + _dl_global_scope = malloc (_dl_global_scope_alloc + * sizeof (struct link_map *)); if (! _dl_global_scope) { _dl_global_scope = _dl_default_scope; @@ -142,7 +143,8 @@ _dl_open (const char *file, int mode) { /* Must extend the list. */ struct link_map **new = realloc (_dl_global_scope, - _dl_global_scope_alloc * 2); + _dl_global_scope_alloc * 2 + * sizeof (struct link_map *)); if (! new) goto nomem; _dl_global_scope_end = new + (_dl_global_scope_end - diff --git a/sysdeps/generic/dl-procinfo.h b/sysdeps/generic/dl-procinfo.h index 801d4b6..4893619 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 8db0c78..7f5e321 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; +} diff --git a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h index 48d5cd3..85baf74 100644 --- a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h @@ -21,19 +21,20 @@ #ifndef _DL_PROCINFO_H #define _DL_PROCINFO_H 1 +static const char *x86_cap_flags[] = + { + "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", + "cx8", "apic", "10", "sep", "mtrr", "pge", "mca", "cmov", + "fcmov", "17", "18", "19", "20", "21", "22", "mmx", + "osfxsr", "25", "26", "27", "28", "29", "30", "amd3d" + }; + static inline int __attribute__ ((unused)) _dl_procinfo (int word) { /* This table should match the information from arch/i386/kernel/setup.c in the kernel sources. */ - static const char *x86_cap_flags[] = - { - "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", - "cx8", "apic", "10", "sep", "mtrr", "pge", "mca", "cmov", - "fcmov", "17", "18", "19", "20", "21", "22", "mmx", - "cxmmx", "25", "26", "27", "28", "29", "30", "amd3d" - }; int i; _dl_sysdep_message ("AT_HWCAP: ", NULL); @@ -47,6 +48,13 @@ _dl_procinfo (int word) return 0; } +static inline const char * +__attribute__ ((unused)) +_dl_hwcap_string (int idx) +{ + return x86_cap_flags[idx]; +}; + enum { HWCAP_I386_FPU = 1 << 0, @@ -66,8 +74,11 @@ enum HWCAP_I386_CMOV = 1 << 15, HWCAP_I386_FCMOV = 1 << 16, HWCAP_I386_MMX = 1 << 23, - HWCAP_I386_CXMMX = 1 << 24, - HWCAP_I386_AMD3D = 1 << 31 + HWCAP_I386_OSFXSR = 1 << 24, + HWCAP_I386_AMD3D = 1 << 31, + + /* XXX Which others to add here? */ + HWCAP_IMPORTANT = (HWCAP_I386_MMX) }; #endif /* dl-procinfo.h */ |