aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/lzma/liblzma/check
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2024-03-24 10:10:32 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2024-03-24 10:21:47 +0300
commitdc2c1c80986f753c62642f0c6a5edff69b7fc8b9 (patch)
tree334bda8d330aea8f9977e28643abaf7c6ed16c63 /contrib/libs/lzma/liblzma/check
parent1c202523203ef21da9a3060e70379cf5b20685d4 (diff)
downloadydb-dc2c1c80986f753c62642f0c6a5edff69b7fc8b9.tar.gz
Update contrib/libs/lzma to 5.6.1
0a981b204173e2ede75381ec3e0bcc40c2770a74
Diffstat (limited to 'contrib/libs/lzma/liblzma/check')
-rw-r--r--contrib/libs/lzma/liblzma/check/crc32_fast.c2
-rw-r--r--contrib/libs/lzma/liblzma/check/crc64_fast.c1
-rw-r--r--contrib/libs/lzma/liblzma/check/crc_common.h25
3 files changed, 28 insertions, 0 deletions
diff --git a/contrib/libs/lzma/liblzma/check/crc32_fast.c b/contrib/libs/lzma/liblzma/check/crc32_fast.c
index 3efe17e1c9..6c79a2dbb7 100644
--- a/contrib/libs/lzma/liblzma/check/crc32_fast.c
+++ b/contrib/libs/lzma/liblzma/check/crc32_fast.c
@@ -135,6 +135,8 @@ typedef uint32_t (*crc32_func_type)(
// This resolver is shared between all three dispatch methods. It serves as
// the ifunc resolver if ifunc is supported, otherwise it is called as a
// regular function by the constructor or first call resolution methods.
+// The function attributes are needed for safe IFUNC resolver usage with GCC.
+lzma_resolver_attributes
static crc32_func_type
crc32_resolve(void)
{
diff --git a/contrib/libs/lzma/liblzma/check/crc64_fast.c b/contrib/libs/lzma/liblzma/check/crc64_fast.c
index f29fe3d3c5..52cddb2c54 100644
--- a/contrib/libs/lzma/liblzma/check/crc64_fast.c
+++ b/contrib/libs/lzma/liblzma/check/crc64_fast.c
@@ -98,6 +98,7 @@ typedef uint64_t (*crc64_func_type)(
# pragma GCC diagnostic ignored "-Wunused-function"
#endif
+lzma_resolver_attributes
static crc64_func_type
crc64_resolve(void)
{
diff --git a/contrib/libs/lzma/liblzma/check/crc_common.h b/contrib/libs/lzma/liblzma/check/crc_common.h
index 856665db79..5a86556f7a 100644
--- a/contrib/libs/lzma/liblzma/check/crc_common.h
+++ b/contrib/libs/lzma/liblzma/check/crc_common.h
@@ -128,6 +128,31 @@
# endif
#endif
+#ifdef CRC_USE_IFUNC
+// Two function attributes are needed to make IFUNC safe with GCC.
+//
+// no-omit-frame-pointer prevents false Valgrind issues when combined with
+// a few other compiler flags. The optimize attribute is supported on
+// GCC >= 4.4 and is not supported with Clang.
+# if TUKLIB_GNUC_REQ(4,4) && !defined(__clang__)
+# define no_omit_frame_pointer \
+ __attribute__((optimize("no-omit-frame-pointer")))
+# else
+# define no_omit_frame_pointer
+# endif
+
+// The __no_profile_instrument_function__ attribute support is checked when
+// determining if ifunc can be used, so it is safe to use unconditionally.
+// This attribute is needed because GCC can add profiling to the IFUNC
+// resolver, which calls functions that have not yet been relocated leading
+// to a crash on liblzma start up.
+# define lzma_resolver_attributes \
+ __attribute__((__no_profile_instrument_function__)) \
+ no_omit_frame_pointer
+#else
+# define lzma_resolver_attributes
+#endif
+
// For CRC32 use the generic slice-by-eight implementation if no optimized
// version is available.
#if !defined(CRC32_ARCH_OPTIMIZED) && !defined(CRC32_GENERIC)