From 60f4134841eaa4c7cf992b0818688236cde43fc8 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sun, 8 Dec 2019 14:56:56 +0300 Subject: [PATCH] mdbx: disable by-default workaround for obsolete E2K bug. Change-Id: I9d6aaf0154e3c9f03dab7948575f4792a13dc988 --- mdbx.h | 17 +++++------------ src/elements/core.c | 9 +++++---- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/mdbx.h b/mdbx.h index deeff371..ef2b40d9 100644 --- a/mdbx.h +++ b/mdbx.h @@ -3512,16 +3512,10 @@ LIBMDBX_API int mdbx_get_attr(MDBX_txn *txn, MDBX_dbi dbi, MDBX_val *key, #endif /* MDBX_NEXENTA_ATTRS */ /******************************************************************************* - * LY: temporary workaround for Elbrus's memcmp() bug. */ -#ifndef __GLIBC_PREREQ -#if defined(__GLIBC__) && defined(__GLIBC_MINOR__) -#define __GLIBC_PREREQ(maj, min) \ - ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) -#else -#define __GLIBC_PREREQ(maj, min) (0) -#endif -#endif /* __GLIBC_PREREQ */ -#if defined(__e2k__) && !__GLIBC_PREREQ(2, 24) + * Workaround for mmaped-lookahead-cross-page-boundary bug + * in an obsolete versions of Elbrus's libc and kernels. */ +#if defined(__e2k__) && defined(MDBX_E2K_MLHCPB_WORKAROUND) && \ + MDBX_E2K_MLHCPB_WORKAROUND LIBMDBX_API int mdbx_e2k_memcmp_bug_workaround(const void *s1, const void *s2, size_t n); LIBMDBX_API int mdbx_e2k_strcmp_bug_workaround(const char *s1, const char *s2); @@ -3544,8 +3538,7 @@ LIBMDBX_API size_t mdbx_e2k_strnlen_bug_workaround(const char *s, #define strlen mdbx_e2k_strlen_bug_workaround #undef strnlen #define strnlen mdbx_e2k_strnlen_bug_workaround - -#endif /* Elbrus's memcmp() bug. */ +#endif /* MDBX_E2K_MLHCPB_WORKAROUND */ #ifdef __cplusplus } diff --git a/src/elements/core.c b/src/elements/core.c index 92bd2b2d..cc78f558 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -578,9 +578,10 @@ static __inline void get_key_optional(const MDBX_node *node, } /*------------------------------------------------------------------------------ - * LY: temporary workaround for Elbrus's memcmp() bug. */ - -#if defined(__e2k__) && !__GLIBC_PREREQ(2, 24) + * Workaround for mmaped-lookahead-cross-page-boundary bug + * in an obsolete versions of Elbrus's libc and kernels. */ +#if defined(__e2k__) && defined(MDBX_E2K_MLHCPB_WORKAROUND) && \ + MDBX_E2K_MLHCPB_WORKAROUND int __hot mdbx_e2k_memcmp_bug_workaround(const void *s1, const void *s2, size_t n) { if (unlikely(n > 42 @@ -688,7 +689,7 @@ size_t __hot mdbx_e2k_strnlen_bug_workaround(const char *s, size_t maxlen) { } return n; } -#endif /* Elbrus's memcmp() bug. */ +#endif /* MDBX_E2K_MLHCPB_WORKAROUND */ /*------------------------------------------------------------------------------ * safe read/write volatile 64-bit fields on 32-bit architectures. */