summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-04-05 15:24:30 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-04-07 08:09:47 -0700
commit32ffd2e11cfe3f7c71988bca8cbe0ba514e71340 (patch)
treeaceb8c8179af8bae4f1a27f2e6a98455fb0698d4 /sysdeps/unix/sysv
parentbf7730194fed694a9ce821c306683266a5a7b78b (diff)
downloadglibc-hjl/hwcap/master.tar.gz
x86: Set dl_hwcap from CPU featureshjl/hwcap/master
On x86, the usage of AT_HWCAP in glibc is obsolete since addition of dl_x86_cpu_features. dl_hwcap, which was set from AT_HWCAP, is used by dynamic linker to build an array of hardware capability names, which are added to search path when loading shared object. dl_hwcap was unused on x86-64 and only SSE2 was used on i386. This patch sets dl_hwcap with new hardware capabilities from CPU features. Currently, 2 capabilities, SSE2 and AVX2, are supported. The maximum number of hardware capabilities is 64. Since x86-64 includes SSE2, SSE2 is skipped on x86-64. dl_x86_cap_flags is kepted for i386 and is used by _dl_show_auxv. dl_x86_hwcap_flags is added for new hardware capabilities. * sysdeps/i386/dl-hwcap.h: New file. * sysdeps/x86/dl-hwcap.h: Likewise. * sysdeps/x86_64/dl-hwcap.h: Likewise. * sysdeps/x86_64/dl-procinfo.h: Likewise. * sysdeps/i386/dl-procinfo.c (_dl_x86_hwcap_flags): New. * sysdeps/i386/dl-procinfo.h: Include <dl-hwcap.h>. (_DL_HWCAP_COUNT): Removed. (HWCAP_I386_XXX): Likewise. (HWCAP_IMPORTANT): Likewise. (_dl_procinfo): Likewise. (_dl_hwcap_string): Likewise. (_dl_string_hwcap): Likewise. * sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_procinfo): Replace _DL_HWCAP_COUNT with 32. * sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h [!IS_IN (ldconfig)]: Include <sysdeps/x86_64/dl-procinfo.h>. * sysdeps/x86/cpu-features.c: Include <dl-hwcap.h>. (init_cpu_features): Set dl_hwcap and dl_hwcap_mask. * sysdeps/x86_64/dl-procinfo.c (_dl_x86_hwcap_flags): New.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/i386/dl-procinfo.h2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
index d49638c2e0..c8196a81dc 100644
--- a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
@@ -36,7 +36,7 @@ _dl_procinfo (unsigned int type, unsigned long int word)
_dl_printf ("AT_HWCAP: ");
- for (i = 0; i < _DL_HWCAP_COUNT; ++i)
+ for (i = 0; i < 32; ++i)
if (word & (1 << i))
_dl_printf (" %s", GLRO(dl_x86_cap_flags)[i]);
diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
index 7829e1cd67..dba5cc960f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
@@ -1,5 +1,5 @@
#if IS_IN (ldconfig)
# include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
#else
-# include <sysdeps/generic/dl-procinfo.h>
+# include <sysdeps/x86_64/dl-procinfo.h>
#endif