]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
liblzma: Define CRC_USE_IFUNC in crc_common.h.
authorJia Tan <jiat0218@gmail.com>
Sat, 14 Oct 2023 02:23:03 +0000 (10:23 +0800)
committerJia Tan <jiat0218@gmail.com>
Wed, 18 Oct 2023 12:41:11 +0000 (20:41 +0800)
When ifunc is supported, we can define a simpler macro instead of
repeating the more complex check in both crc32_fast.c and crc64_fast.c.

src/liblzma/check/crc32_fast.c
src/liblzma/check/crc64_fast.c
src/liblzma/check/crc_common.h

index 5229a4bd3cd1d466bcfe7ff3bbe8d514ebab3b8c..3ac9b6d70b42acf03d49737c12b9ba5327488f7b 100644 (file)
@@ -272,8 +272,7 @@ crc32_dispatch(const uint8_t *buf, size_t size, uint32_t crc)
 #endif
 
 
-#if defined(CRC_GENERIC) && defined(CRC_CLMUL) \
-               && defined(HAVE_FUNC_ATTRIBUTE_IFUNC)
+#ifdef CRC_USE_IFUNC
 extern LZMA_API(uint32_t)
 lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
                __attribute__((__ifunc__("crc32_resolve")));
index 88ba7d33157dbea53fe1104aa772ffc4ff8cb70e..79b662a4c25eb6a6f0ff2c5d79a7ff8fd29be0b3 100644 (file)
@@ -274,8 +274,7 @@ crc64_dispatch(const uint8_t *buf, size_t size, uint64_t crc)
 #endif
 
 
-#if defined(CRC_GENERIC) && defined(CRC_CLMUL) \
-               && defined(HAVE_FUNC_ATTRIBUTE_IFUNC)
+#ifdef CRC_USE_IFUNC
 extern LZMA_API(uint64_t)
 lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
                __attribute__((__ifunc__("crc64_resolve")));
index 867e53d91ff187a0a32f38248bcfc18160343d1a..55fdd55e6eaee8423549458d36920577d0c40b2e 100644 (file)
@@ -34,6 +34,7 @@
 
 #undef CRC_GENERIC
 #undef CRC_CLMUL
+#undef CRC_USE_IFUNC
 #undef CRC_USE_GENERIC_FOR_SMALL_INPUTS
 
 // If CLMUL cannot be used then only the generic slice-by-four is built.
 #      define CRC_GENERIC 1
 #      define CRC_CLMUL 1
 
+#      ifdef HAVE_FUNC_ATTRIBUTE_IFUNC
+#              define CRC_USE_IFUNC 1
+#      endif
+
 /*
        // The generic code is much faster with 1-8-byte inputs and has
        // similar performance up to 16 bytes  at least in microbenchmarks