aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/check/crc64_fast.c
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2024-03-09 09:20:57 +0800
committerJia Tan <jiat0218@gmail.com>2024-03-09 09:20:57 +0800
commit82ecc538193b380a21622aea02b0ba078e7ade92 (patch)
treee7f270edf8d9f9510ab4182e896eb1f091bd0b62 /src/liblzma/check/crc64_fast.c
parentliblzma: Fix a typo in a comment in the RISC-V filter. (diff)
downloadxz-82ecc538193b380a21622aea02b0ba078e7ade92.tar.xz
liblzma: Fix false Valgrind error report with GCC.
With GCC and a certain combination of flags, Valgrind will falsely trigger an invalid write. This appears to be due to the omission of instructions to properly save, set up, and restore the frame pointer. The IFUNC resolver is a leaf function since it only calls a function that is inlined. So sometimes GCC omits the frame pointer instructions in the resolver unless this optimization is explictly disabled. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=2267598.
Diffstat (limited to 'src/liblzma/check/crc64_fast.c')
-rw-r--r--src/liblzma/check/crc64_fast.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/liblzma/check/crc64_fast.c b/src/liblzma/check/crc64_fast.c
index 5728b45e..330a5016 100644
--- a/src/liblzma/check/crc64_fast.c
+++ b/src/liblzma/check/crc64_fast.c
@@ -98,13 +98,12 @@ typedef uint64_t (*crc64_func_type)(
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
-#ifdef CRC_USE_IFUNC
-__attribute__((__no_profile_instrument_function__))
-#endif
+// The funcion attributes are needed for safe IFUNC resolver usage with GCC.
+lzma_resolver_attributes
static crc64_func_type
crc64_resolve(void)
{
- return is_arch_extension_supported()
+ return is_arch_extension_supported()
? &crc64_arch_optimized : &crc64_generic;
}