liblzma: Only use ifunc in crcXX_fast.c if its needed.

The code was using HAVE_FUNC_ATTRIBUTE_IFUNC instead of CRC_USE_IFUNC.
With ARM64, ifunc is incompatible because it requires non-inline
function calls for runtime detection.
This commit is contained in:
Jia Tan 2024-01-23 18:02:13 +08:00
parent 30a25f3742
commit 2f1552a91c
2 changed files with 6 additions and 6 deletions

View File

@ -128,7 +128,7 @@ typedef uint32_t (*crc32_func_type)(
// Clang 16.0.0 and older has a bug where it marks the ifunc resolver // Clang 16.0.0 and older has a bug where it marks the ifunc resolver
// function as unused since it is static and never used outside of // function as unused since it is static and never used outside of
// __attribute__((__ifunc__())). // __attribute__((__ifunc__())).
#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(__clang__) #if defined(CRC_USE_IFUNC) && defined(__clang__)
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-function" # pragma GCC diagnostic ignored "-Wunused-function"
#endif #endif
@ -143,11 +143,11 @@ crc32_resolve(void)
? &crc32_arch_optimized : &crc32_generic; ? &crc32_arch_optimized : &crc32_generic;
} }
#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(__clang__) #if defined(CRC_USE_IFUNC) && defined(__clang__)
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif
#ifndef HAVE_FUNC_ATTRIBUTE_IFUNC #ifndef CRC_USE_IFUNC
#ifdef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR #ifdef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR
// Constructor method. // Constructor method.

View File

@ -94,7 +94,7 @@ crc64_generic(const uint8_t *buf, size_t size, uint64_t crc)
typedef uint64_t (*crc64_func_type)( typedef uint64_t (*crc64_func_type)(
const uint8_t *buf, size_t size, uint64_t crc); const uint8_t *buf, size_t size, uint64_t crc);
#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(__clang__) #if defined(CRC_USE_IFUNC) && defined(__clang__)
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-function" # pragma GCC diagnostic ignored "-Wunused-function"
#endif #endif
@ -106,11 +106,11 @@ crc64_resolve(void)
? &crc64_arch_optimized : &crc64_generic; ? &crc64_arch_optimized : &crc64_generic;
} }
#if defined(HAVE_FUNC_ATTRIBUTE_IFUNC) && defined(__clang__) #if defined(CRC_USE_IFUNC) && defined(__clang__)
# pragma GCC diagnostic pop # pragma GCC diagnostic pop
#endif #endif
#ifndef HAVE_FUNC_ATTRIBUTE_IFUNC #ifndef CRC_USE_IFUNC
#ifdef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR #ifdef HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR
# define CRC64_SET_FUNC_ATTR __attribute__((__constructor__)) # define CRC64_SET_FUNC_ATTR __attribute__((__constructor__))