[MDEV-23585] checksum.c: only use clmul if available Created: 2020-08-26  Updated: 2020-10-06  Resolved: 2020-08-27

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.5.4
Fix Version/s: 10.5.7

Type: Bug Priority: Major
Reporter: Anel Husakovic Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-22641 Provide SIMD optimized wrapper for zl... Closed

 Description   

If the build environment does not support PCLMUL, then crc32_x86.c is not compiled in, and this fails to link.
Only call the functions in crc32_x86.c if they have been included.

fixes builds on older processors without PCLMUL

see: https://trac.macports.org/ticket/61063

Patch of interest dec3f8ca69e5e



 Comments   
Comment by Marko Mäkelä [ 2020-08-27 ]

There were actually three separate problems, which I fixed:

  1. In some GCC-compatible AMD64 build environments, the CMake check for HAVE_CLMUL_INSTRUCTION was being skipped unnecessarily.
  2. The result of the HAVE_CLMUL_INSTRUCTION check was not passed to the compilation.
  3. The SIMD acceleration was unnecessarily limited to 64-bit builds, while it works fine on 32-bit too.
Comment by Marko Mäkelä [ 2020-08-27 ]

I revised the HAVE_CLMUL_INSTRUCTION check to include inline assembler code for the cpuid instruction, because 32-bit -fPIC builds would fail on GCC 4.8.2. GCC 5 implemented register spilling for the PIC register (ebx) that would be clobbered by the cpuid instruction.

Generated at Thu Feb 08 09:23:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.