summaryrefslogtreecommitdiffstats
path: root/source/a
diff options
context:
space:
mode:
Diffstat (limited to 'source/a')
-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. */
+ }
+
+