diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-05-03 13:42:42 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-05-03 13:44:35 -0700 |
commit | 1432d38ea04ab5e96f21a382101856db5b49ad8a (patch) | |
tree | 90330655c7751e3f10a9cecbd190fa50ab368bac /sysdeps/unix | |
parent | 3b5f801ddb838311b5b05c218caac3bdb00d7c95 (diff) | |
download | glibc-1432d38ea04ab5e96f21a382101856db5b49ad8a.tar glibc-1432d38ea04ab5e96f21a382101856db5b49ad8a.tar.gz glibc-1432d38ea04ab5e96f21a382101856db5b49ad8a.tar.bz2 glibc-1432d38ea04ab5e96f21a382101856db5b49ad8a.zip |
x86: Set dl_platform and dl_hwcap from CPU features [BZ #21391]
dl_platform and dl_hwcap are set from AT_PLATFORM and AT_HWCAP very
early during startup. They are used by dynamic linker to determine
platform and build an array of hardware capability names, which are
added to search path when loading shared object. dl_platform and
dl_hwcap are unused on x86-64. On i386, i386, i486, i586 and i686
platforms were supported and only SSE2 capability was used.
On x86, usage of AT_PLATFORM and AT_HWCAP to determine platform and
processor capabilities is obsolete since all information is available
in dl_x86_cpu_features. This patch sets dl_platform and dl_hwcap from
dl_x86_cpu_features in dynamic linker. On i386, the available plaforms
are changed to i586 and i686 since i386 has been deprecated. On x86-64,
the available plaforms are haswell, which is for Haswell class processors
with BMI1, BMI2, LZCNT, MOVBE, POPCNT, AVX2 and FMA, and xeon_phi, which
is for Xeon Phi class processors with AVX512F, AVX512CD, AVX512ER and
AVX512PF. A capability, avx512_1, is also added to x86-64 for AVX512
ISAs: AVX512F, AVX512CD, AVX512BW, AVX512DQ and AVX512VL.
[BZ #21391]
* sysdeps/i386/dl-machine.h (dl_platform_init) [IS_IN (rtld)]:
Only call init_cpu_features.
[!IS_IN (rtld)]: Only set GLRO(dl_platform) to NULL if needed.
* sysdeps/x86_64/dl-machine.h (dl_platform_init): Likewise.
* sysdeps/i386/dl-procinfo.h: Removed.
* sysdeps/unix/sysv/linux/i386/dl-procinfo.h: Don't include
<sysdeps/i386/dl-procinfo.h> nor <ldsodefs.h>. Include
<sysdeps/x86/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/dl-procinfo.h> instead of
<sysdeps/generic/dl-procinfo.h>.
* sysdeps/x86/cpu-features.c: Include <dl-hwcap.h>.
(init_cpu_features): Set dl_platform, dl_hwcap and dl_hwcap_mask.
* sysdeps/x86/cpu-features.h (bit_cpu_LZCNT): New.
(bit_cpu_MOVBE): Likewise.
(bit_cpu_BMI1): Likewise.
(bit_cpu_BMI2): Likewise.
(index_cpu_BMI1): Likewise.
(index_cpu_BMI2): Likewise.
(index_cpu_LZCNT): Likewise.
(index_cpu_MOVBE): Likewise.
(index_cpu_POPCNT): Likewise.
(reg_BMI1): Likewise.
(reg_BMI2): Likewise.
(reg_LZCNT): Likewise.
(reg_MOVBE): Likewise.
(reg_POPCNT): Likewise.
* sysdeps/x86/dl-hwcap.h: New file.
* sysdeps/x86/dl-procinfo.h: Likewise.
* sysdeps/x86/dl-procinfo.c (_dl_x86_hwcap_flags): New.
(_dl_x86_platforms): Likewise.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/dl-procinfo.h | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h index d49638c2e0..a3a5f9d277 100644 --- a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h +++ b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h @@ -17,9 +17,7 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <sysdeps/i386/dl-procinfo.h> -#include <ldsodefs.h> - +#include <sysdeps/x86/dl-procinfo.h> #undef _dl_procinfo static inline int @@ -36,7 +34,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..7b45fe4bf8 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/dl-procinfo.h> #endif |