From a5836c95a60f4cdfbc2b521bc052023247366aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 24 Feb 2024 18:29:50 +0100 Subject: [PATCH] Use `#pragma GCC target` to enable CRC in ARM64 hw implementation Use `#pragma GCC target ("+crc+crypto")` to enable the necessary features in the ARM64 hardware CRC32c implementation. This makes it possible to build it without setting `-march` globally. This should work with GCC 6.3+, and Clang 18 (tested via godbolt.org). Older versions of Clang may require explicit `-march=` still. --- crc32c_arm64.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crc32c_arm64.c b/crc32c_arm64.c index 853334f..4e29edc 100644 --- a/crc32c_arm64.c +++ b/crc32c_arm64.c @@ -16,6 +16,10 @@ #if defined(IS_ARM) && (defined(__linux__) || defined(linux)) +#if defined(__GNUC__) +# pragma GCC target ("+crc+crypto") +#endif + #include #include