summaryrefslogtreecommitdiffstats
path: root/source/a/coreutils
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2023-08-26 21:01:45 +0000
committer Eric Hameleers <alien@slackware.com>2023-08-26 23:33:08 +0200
commitee5ad0d97a7f544c15e408bc483f5470ed363a51 (patch)
tree5961e5eac39ac7ae15e972f3af3bfde8b344553b /source/a/coreutils
parentd4b1ae07fbdffaf47926eb85a1acabc9125759f2 (diff)
downloadcurrent-ee5ad0d97a7f544c15e408bc483f5470ed363a51.tar.gz
current-ee5ad0d97a7f544c15e408bc483f5470ed363a51.tar.xz
Sat Aug 26 21:01:45 UTC 202320230826210145
a/coreutils-9.3-x86_64-2.txz: Rebuilt. Don't support AVX2 instructions for wc. Since it's possible to enable a kernel option that causes the kernel to advertise AVX2 as available, but leads to an illegal instruction if there's an attempt to actually use AVX2 when old microcode is in use, this isn't reliable. Furthermore, wc is used by the pkgtools and this sort of failure could lead to corruption of the filesystem and/or package database. So, we'll disable this to be on the safe side. Thanks to lancsuk for noticing this issue. a/kernel-generic-6.1.48-x86_64-1.txz: Upgraded. a/kernel-huge-6.1.48-x86_64-1.txz: Upgraded. a/kernel-modules-6.1.48-x86_64-1.txz: Upgraded. d/kernel-headers-6.1.48-x86-1.txz: Upgraded. k/kernel-source-6.1.48-noarch-1.txz: Upgraded. isolinux/initrd.img: Rebuilt. kernels/*: Upgraded. usb-and-pxe-installers/usbboot.img: Rebuilt.
Diffstat (limited to 'source/a/coreutils')
-rwxr-xr-xsource/a/coreutils/coreutils.SlackBuild13
-rw-r--r--source/a/coreutils/coreutils.wc.noavx2.diff18
2 files changed, 30 insertions, 1 deletions
diff --git a/source/a/coreutils/coreutils.SlackBuild b/source/a/coreutils/coreutils.SlackBuild
index 33a9060ef..16557086c 100755
--- a/source/a/coreutils/coreutils.SlackBuild
+++ b/source/a/coreutils/coreutils.SlackBuild
@@ -24,10 +24,17 @@ cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=coreutils
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | cut -d - -f 2 | rev | cut -f 3- -d . | rev)}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
+# "wc" seems to be the only thing used by pkgtools that can make use of AVX2,
+# and since the kernel has added a mitigation that makes AVX2 seem to be
+# available when it really isn't, it is not reliable. Even the author of this
+# wc optimization questioned how useful it really was... and for us, it isn't
+# worth it to have by default. But feel free to enable/recompile if you like.
+DISABLE_USE_AVX2_WC_LINECOUNT=${DISABLE_USE_AVX2_WC_LINECOUNT:-true}
+
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@@ -93,6 +100,10 @@ zcat $CWD/$PKGNAM.uname.diff.gz | patch -p1 --verbose --backup --suffix=.orig ||
# Revert change to ls quoting style introduced in coreutils-8.25:
zcat $CWD/no_ls_quoting.patch.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
+if [ "$DISABLE_USE_AVX2_WC_LINECOUNT" = "true" ]; then
+ zcat $CWD/coreutils.wc.noavx2.diff.gz | patch -p1 --verbose || exit 1
+fi
+
# Compilation with glibc version later than 2.3.2 needs the environment
# variable DEFAULT_POSIX2_VERSION set to 199209.
# Without that line, the coreutils will start complaining about 'obsolete'
diff --git a/source/a/coreutils/coreutils.wc.noavx2.diff b/source/a/coreutils/coreutils.wc.noavx2.diff
new file mode 100644
index 000000000..605757992
--- /dev/null
+++ b/source/a/coreutils/coreutils.wc.noavx2.diff
@@ -0,0 +1,18 @@
+--- ./src/wc.c.orig 2023-04-10 05:14:08.000000000 -0500
++++ ./src/wc.c 2023-08-26 14:22:10.058092456 -0500
+@@ -174,14 +174,7 @@
+
+ if (avx_enabled)
+ {
+- eax = ebx = ecx = edx = 0;
+- if (! __get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx))
+- getcpuid_ok = false;
+- else
+- {
+- if (! (ebx & bit_AVX2))
+- avx_enabled = false; /* Hardware doesn't support it. */
+- }
++ avx_enabled = false; /* Never use AVX2. */
+ }
+
+