about summary refs log tree commit diff
path: root/sysdeps/x86_64/dl-hwcap.h
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/x86_64/dl-hwcap.h
parentbf7730194fed694a9ce821c306683266a5a7b78b (diff)
downloadglibc-32ffd2e11cfe3f7c71988bca8cbe0ba514e71340.tar.gz
glibc-32ffd2e11cfe3f7c71988bca8cbe0ba514e71340.tar.xz
glibc-32ffd2e11cfe3f7c71988bca8cbe0ba514e71340.zip
x86: Set dl_hwcap from CPU features hjl/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/x86_64/dl-hwcap.h')
-rw-r--r--sysdeps/x86_64/dl-hwcap.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/sysdeps/x86_64/dl-hwcap.h b/sysdeps/x86_64/dl-hwcap.h
new file mode 100644
index 0000000000..6e31fa91be
--- /dev/null
+++ b/sysdeps/x86_64/dl-hwcap.h
@@ -0,0 +1,25 @@
+/* x86-64 version of hardware capability information handling macros.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _DL_HWCAP_H
+#define _DL_HWCAP_H
+#include <sysdeps/x86/dl-hwcap.h>
+
+#define HWCAP_IMPORTANT		(HWCAP_X86_AVX2)
+
+#endif /* dl-hwcap.h */