aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/dl-procinfo.c
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/i386/dl-procinfo.c
parentbf7730194fed694a9ce821c306683266a5a7b78b (diff)
downloadglibc-hjl/hwcap/master.tar
glibc-hjl/hwcap/master.tar.gz
glibc-hjl/hwcap/master.tar.bz2
glibc-hjl/hwcap/master.zip
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/i386/dl-procinfo.c')
-rw-r--r--sysdeps/i386/dl-procinfo.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysdeps/i386/dl-procinfo.c b/sysdeps/i386/dl-procinfo.c
index cec7dccfb8..acb800b342 100644
--- a/sysdeps/i386/dl-procinfo.c
+++ b/sysdeps/i386/dl-procinfo.c
@@ -79,6 +79,22 @@ PROCINFO_CLASS const char _dl_x86_cap_flags[32][8]
#endif
#if !defined PROCINFO_DECL && defined SHARED
+ ._dl_x86_hwcap_flags
+#else
+PROCINFO_CLASS const char _dl_x86_hwcap_flags[2][8]
+#endif
+#ifndef PROCINFO_DECL
+= {
+ "sse2", "avx2"
+ }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#if !defined PROCINFO_DECL && defined SHARED
._dl_x86_platforms
#else
PROCINFO_CLASS const char _dl_x86_platforms[4][5]