Subject: Re: bug#78562: Coreutils-9.7 do not build on macOS High Sierra, Version 10.13.6, because src/cksum.c: uses invalid cpu feature string for builtin

From: Peter Dyballa <[email-masked]>
Date: Sat, 24 May 2025 11:29:33 +0200

> Am 24.05.2025 um 01:37 schrieb Pádraig Brady <[email-masked]>:
> 
> I suspect the following will avoid the issue:

It does not:

	/usr/bin/clang  -I. -I./lib  -Ilib -I./lib -Isrc -I./src -I/opt/local/include -mavx -mpclmul  -Wno-format-extra-args -Wno-tautological-constant-out-of-range-compare -pipe -Os -arch x86_64 -MT src/libcksum_pclmul_a-cksum_pclmul.o -MD -MP -MF src/.deps/libcksum_pclmul_a-cksum_pclmul.Tpo -c -o src/libcksum_pclmul_a-cksum_pclmul.o `test -f 'src/cksum_pclmul.c' || echo './'`src/cksum_pclmul.c
	src/cksum.c:190:30: error: invalid cpu feature string for builtin
	  bool avx512_enabled = (0 < __builtin_cpu_supports ("vpclmulqdq")
	                             ^                       ~~~~~~~~~~~~
	1 error generated.
	make[2]: *** [src/cksum-cksum.o] Error 1

I then set GCC 14 as compiler to build (instead of Clang 17.0.6). The result is:

	mv -f src/.deps/libcksum_avx2_a-cksum_avx2.Tpo src/.deps/libcksum_avx2_a-cksum_avx2.Po
	depbase=`echo src/ls-dir.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
		/opt/local/bin/gcc-mp-14  -I. -I./lib  -Ilib -I./lib -Isrc -I./src -I/opt/local/include   -pipe -Os -arch x86_64 -MT src/ls-dir.o -MD -MP -MF $depbase.Tpo -c -o src/ls-dir.o src/ls-dir.c &&\
		mv -f $depbase.Tpo $depbase.Po
	<stdin>:59:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       lC0(%rip), %zmm0
	        ^
	<stdin>:62:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       lC2(%rip), %zmm7
	        ^
	<stdin>:63:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       lC1(%rip), %zmm2
	        ^
	<stdin>:78:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       64(%rsp), %zmm3
	        ^
	<stdin>:82:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       128(%rsp), %zmm10
	        ^
	<stdin>:85:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:86:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       192(%rsp), %zmm9
	        ^
	<stdin>:87:2: error: instruction requires: AVX-512 ISA
	        vpxord  %zmm3, %zmm1, %zmm1
	        ^
	<stdin>:88:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm10, %zmm10
	        ^
	<stdin>:89:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       256(%rsp), %zmm8
	        ^
	<stdin>:90:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm9, %zmm9
	        ^
	<stdin>:91:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm8, %zmm8
	        ^
	<stdin>:93:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm2, %zmm1, %zmm5
	        ^
	<stdin>:95:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       256(%rdi), %zmm6
	        ^
	<stdin>:97:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm2, %zmm1, %zmm1
	        ^
	<stdin>:99:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm2, %zmm10, %zmm4
	        ^
	<stdin>:100:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm6, %zmm6
	        ^
	<stdin>:101:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm2, %zmm10, %zmm10
	        ^
	<stdin>:102:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm2, %zmm9, %zmm3
	        ^
	<stdin>:103:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm2, %zmm9, %zmm9
	        ^
	<stdin>:104:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm2, %zmm8, %zmm11
	        ^
	<stdin>:105:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm1, %zmm5, %zmm6
	        ^
	<stdin>:106:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm2, %zmm8, %zmm8
	        ^
	<stdin>:107:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       64(%rdi), %zmm5
	        ^
	<stdin>:108:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm6, %zmm1
	        ^
	<stdin>:109:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm5, %zmm5
	        ^
	<stdin>:110:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm10, %zmm4, %zmm5
	        ^
	<stdin>:111:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       128(%rdi), %zmm4
	        ^
	<stdin>:112:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm5, %zmm10
	        ^
	<stdin>:113:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm4, %zmm4
	        ^
	<stdin>:114:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm9, %zmm3, %zmm4
	        ^
	<stdin>:115:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       192(%rdi), %zmm3
	        ^
	<stdin>:116:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm4, %zmm9
	        ^
	<stdin>:117:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:118:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm11, %zmm8, %zmm3
	        ^
	<stdin>:119:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm3, %zmm8
	        ^
	<stdin>:122:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm6, %zmm6
	        ^
	<stdin>:124:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm5, %zmm5
	        ^
	<stdin>:126:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm4, %zmm4
	        ^
	<stdin>:127:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:132:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm6, (%rax)
	        ^
	<stdin>:133:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm5, 64(%rax)
	        ^
	<stdin>:134:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm4, 128(%rax)
	        ^
	<stdin>:135:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm3, 192(%rax)
	        ^
	<stdin>:137:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       (%rax), %zmm3
	        ^
	<stdin>:143:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:144:2: error: instruction requires: AVX-512 ISA
	        vpxord  %zmm3, %zmm1, %zmm1
	        ^
	<stdin>:146:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $0, %zmm7, %zmm1, %zmm4
	        ^
	<stdin>:147:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       64(%rax,%rsi), %zmm3
	        ^
	<stdin>:150:2: error: instruction requires: AVX-512 ISA
	        vpclmulqdq      $17, %zmm7, %zmm1, %zmm1
	        ^
	<stdin>:153:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:154:2: error: instruction requires: AVX-512 ISA
	        vpternlogd      $150, %zmm1, %zmm4, %zmm3
	        ^
	<stdin>:155:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm3, %zmm1
	        ^
	<stdin>:159:2: error: instruction requires: AVX-512 BW ISA
	        vpshufb %zmm0, %zmm3, %zmm3
	        ^
	<stdin>:166:2: error: instruction requires: AVX-512 ISA
	        vmovdqa64       %zmm3, (%rax)
	        ^
	make[2]: *** [src/libcksum_avx512_a-cksum_avx512.o] Error 1

Is this more of an assembler problem? Installed are:

/usr/bin/as		Apple LLVM version 10.0.0 (clang-1000.11.45.5)
/opt/local/bin/nasm	NASM version 2.16.03 compiled on May 17 2024
/opt/local/bin/yasm	yasm 1.3.0
no gas

To determine which assembler is used I added "-Wa,-v" to CFLAGS and got:

	Apple LLVM version 10.0.0 (clang-1000.10.44.4)
	Target: x86_64-apple-darwin17.7.0
	Thread model: posix
	InstalledDir: /Library/Developer/CommandLineTools/usr/bin

--
Greetings

  Pete

The human brain operates at only 10% of its capacity. The rest is overhead for the operating system.