2024-12-21 Bruno Haible <bruno@clisp.org>
+ crc-x86_64: Fix compilation error with clang.
+ * modules/crc-x86_64 (Makefile.am): Declare a separate library
+ libpclmul.{a,la}.
+ * lib/crc-x86_64-pclmul.c: Remove the GCC pragmas.
+
gnulib-tool: Recognize @LT@, @la@, @lo@ tokens in module descriptions.
* gnulib-tool.sh (func_emit_lib_Makefile_am): Replace @LT@, @la@, @lo@
tokens.
#include <string.h>
-#pragma GCC push_options
-#pragma GCC target("pclmul,avx")
uint32_t
crc32_update_no_xor_pclmul (uint32_t crc, const void *buf, size_t len)
{
return crc;
}
-
-#pragma GCC pop_options
Makefile.am:
if GL_CRC_X86_64_PCLMUL
-lib_SOURCES += crc-x86_64-pclmul.c
+# We need a separate library, in order to compile crc-x86_64-pclmul.c with
+# particular CFLAGS.
+# (Recall that '#pragma GCC target (...)' works only with gcc, not with clang.
+# And the alternative approach of target-specific CFLAGS in 'make' syntax
+# <https://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html>
+# is not portable: it does not work with OpenBSD 'make'.)
+noinst_@LT@LIBRARIES += libpclmul.@la@
+libpclmul_@la@_SOURCES = crc-x86_64-pclmul.c
+libpclmul_@la@_CFLAGS = $(AM_CFLAGS) -mavx -mpclmul
+lib_LIBADD += libpclmul_@la@-crc-x86_64-pclmul.@lo@
+lib_DEPENDENCIES += libpclmul.@la@
endif
Include: