From: Boris Ranto Date: Thu, 5 Aug 2021 07:08:08 +0000 (+0200) Subject: librados/librados_c: check for both symvers X-Git-Tag: v16.2.11~358^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c1d324d207661af146d915a1e239b5c6eb7eea63;p=ceph.git 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 (cherry picked from commit ff1941a8d34f52ca25c31e9945f3591feb304b55) --- diff --git a/src/librados/librados_c.cc b/src/librados/librados_c.cc index 979dc10fd563..5d9bdb7b23dd 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 "@")))