From ff1941a8d34f52ca25c31e9945f3591feb304b55 Mon Sep 17 00:00:00 2001 From: Boris Ranto Date: Thu, 5 Aug 2021 09:08:08 +0200 Subject: [PATCH] librados/librados_c: check for both symvers We should check if either asm symver or attribute symver is defined and not assume that attribute symver implies asm symver. Fixes: https://tracker.ceph.com/issues/40060 Signed-off-by: Boris Ranto --- src/librados/librados_c.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librados/librados_c.cc b/src/librados/librados_c.cc index dd1723dd5eb33..b56732b1a95aa 100644 --- a/src/librados/librados_c.cc +++ b/src/librados/librados_c.cc @@ -43,7 +43,13 @@ #define tracepoint(...) #endif -#ifdef HAVE_ASM_SYMVER +#if defined(HAVE_ASM_SYMVER) || defined(HAVE_ATTR_SYMVER) +// prefer __attribute__() over global asm(".symver"). because the latter +// is not parsed by the compiler and is partitioned away by GCC if +// lto-partitions is enabled, in other words, these asm() statements +// are dropped by the -flto option by default. the way to address it is +// to use __attribute__. so this information can be processed by the +// C compiler, and be preserved after LTO partitions the code #ifdef HAVE_ATTR_SYMVER #define LIBRADOS_C_API_BASE(fn) \ extern __typeof (_##fn##_base) _##fn##_base __attribute__((__symver__ (#fn "@"))) -- 2.39.5