From dd01aabaebee262552f3920e57f66fed2d04dbd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Mon, 8 Aug 2022 15:06:27 +0300 Subject: [PATCH] mdbx: add `MDBX_WEAK_IMPORT_ATTRIBUTE` macro. --- src/base.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/base.h b/src/base.h index e5297745..4c9e77cd 100644 --- a/src/base.h +++ b/src/base.h @@ -611,6 +611,19 @@ __extern_C key_t ftok(const char *, int); #endif #endif /* __anonymous_struct_extension__ */ +#ifndef MDBX_WEAK_IMPORT_ATTRIBUTE +#ifdef WEAK_IMPORT_ATTRIBUTE +#define MDBX_WEAK_IMPORT_ATTRIBUTE WEAK_IMPORT_ATTRIBUTE +#elif __has_attribute(__weak__) && __has_attribute(__weak_import__) +#define MDBX_WEAK_IMPORT_ATTRIBUTE __attribute__((__weak__, __weak_import__)) +#elif __has_attribute(__weak__) || \ + (defined(__GNUC__) && __GNUC__ >= 4 && defined(__ELF__)) +#define MDBX_WEAK_IMPORT_ATTRIBUTE __attribute__((__weak__)) +#else +#define MDBX_WEAK_IMPORT_ATTRIBUTE +#endif +#endif /* MDBX_WEAK_IMPORT_ATTRIBUTE */ + /*----------------------------------------------------------------------------*/ #if defined(MDBX_USE_VALGRIND)