bug#79491: coreutils build failure with -mno-pclmul
Sam James <[email protected]>
| Newsgroups | gmane.comp.gnu.core-utils.bugs |
|---|---|
| Organization | Gentoo |
| Message-ID | <[email protected]> |
Hi,
We had a report downstream in Gentoo at https://bugs.gentoo.org/959467
of a build failure for coreutils when pasisng -mno-pclmul.
Ionen's analysis on the bug seems good to me, so quoting that:
"""
Haven't looked all that in-depth, but I wonder why src/cksum.c checks for gnulib's GL_CRC_X86_64_PCLMUL at all, and also why it manages to be set?
coreutils own's pclmul check to set USE_PCLMUL_CRC32 does:
ac_save_CFLAGS=$CFLAGS
CFLAGS="-mavx -mpclmul $CFLAGS"
CFLAGS here has -mno-pclmul and comes after -mpclmul, so as expected:
checking if vmull intrinsic exists... no
checking if pclmul intrinsic exists... no
checking if avx2 pclmul intrinsic exists... no
checking if avx512 pclmul intrinsic exists... no
But then there is another (lone) check, done by gnulib's m4/crc-x86_64.m4 which pass for some reason (despite i686 and -mno-pclmul) and sets GL_CRC_X86_64_PCLMUL:
checking if pclmul intrinsic exists... yes
Then pclmul_supported function has:
# if USE_PCLMUL_CRC32 || GL_CRC_X86_64_PCLMUL
And finally src/cksum_pclmul.c is only built if USE_PCLMUL_CRC32, while GL_CRC_X86_64_PCLMUL builds lib/crc-x86_64-pclmul.c (I see it in the build.log)
However crc-x86_64-pclmul.c does not define cksum_pclmul, and
pclmul_supported does not use anything from that crc-x86_64-pclmul.c
that I can see? I could be missing something but the simple fix may be
to just drop the "|| GL_CRC_X86_64_PCLMUL" check.
"""
I can reproduce it with e.g. coreutils-9.8 with:
$ ./configure CFLAGS="-march=westmere -mno-aes -mno-avx -mno-pclmul -O2 -pipe"
$ make
/usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../x86_64-pc-linux-gnu/bin/ld: src/cksum-cksum.o: in function `pclmul_supported':
cksum.c:(.text+0x2c6): undefined reference to `cksum_pclmul'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:11791: src/cksum] Error 1
thanks,
sam