forked from rpms/glibc
83835daada
Fedora commit: 4f55bd2df5c705c99f21e1d35941843212b3e3a1 Related: #1945473 Resolves: #1945472 Resolves: #1915330
74 lines
2.7 KiB
Diff
74 lines
2.7 KiB
Diff
Downstream-only patch to enhance CPU detection. Review thread:
|
|
|
|
<https://sourceware.org/pipermail/libc-alpha/2021-May/125916.html>
|
|
|
|
Author: Florian Weimer <fweimer@redhat.com>
|
|
Date: Thu May 6 11:55:09 2021 +0200
|
|
|
|
powerpc64le: Check HWCAP bits against compiler build flags
|
|
|
|
When built with GCC 11.1 and -mcpu=power9, ld.so prints this error
|
|
message when running on POWER8:
|
|
|
|
Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required)
|
|
|
|
This approach does not work for the POWER10 because the bootstrap
|
|
relocation already uses PCREL instructions, so the detection code does
|
|
not actually run.
|
|
|
|
diff --git a/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h
|
|
new file mode 100644
|
|
index 0000000000000000..6c7949c6d27ab0b4
|
|
--- /dev/null
|
|
+++ b/sysdeps/powerpc/powerpc64/le/dl-hwcap-check.h
|
|
@@ -0,0 +1,49 @@
|
|
+/* Check for hardware capabilities after HWCAP parsing. powerpc64le version.
|
|
+ Copyright (C) 2021 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
|
|
+ <https://www.gnu.org/licenses/>. */
|
|
+
|
|
+#ifndef _DL_HWCAP_CHECK_H
|
|
+#define _DL_HWCAP_CHECK_H
|
|
+
|
|
+#include <ldsodefs.h>
|
|
+
|
|
+static inline void
|
|
+dl_hwcap_check (void)
|
|
+{
|
|
+#ifdef _ARCH_PWR9
|
|
+ if ((GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_00) == 0)
|
|
+ _dl_fatal_printf ("\
|
|
+Fatal glibc error: CPU lacks ISA 3.00 support (POWER9 or later required)\n");
|
|
+#endif
|
|
+#ifdef __FLOAT128_HARDWARE__
|
|
+ if ((GLRO (dl_hwcap2) & PPC_FEATURE2_HAS_IEEE128) == 0)
|
|
+ _dl_fatal_printf ("\
|
|
+Fatal glibc error: CPU lacks float128 support (POWER 9 or later required)\n");
|
|
+#endif
|
|
+#if defined _ARCH_PWR10 || defined __PCREL__
|
|
+ if ((GLRO (dl_hwcap2) & PPC_FEATURE2_ARCH_3_1) == 0)
|
|
+ _dl_fatal_printf ("\
|
|
+Fatal glibc error: CPU lacks ISA 3.10 support (POWER10 or later required)\n");
|
|
+#endif
|
|
+#ifdef __MMA__
|
|
+ if ((GLRO (dl_hwcap2) & PPC_FEATURE2_MMA) == 0)
|
|
+ _dl_fatal_printf ("\
|
|
+Fatal glibc error: CPU lacks MMA support (POWER10 or later required)\n");
|
|
+#endif
|
|
+}
|
|
+
|
|
+#endif /* _DL_HWCAP_CHECK_H */
|