]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados/librados_c: check for both symvers
authorBoris Ranto <branto@redhat.com>
Thu, 5 Aug 2021 07:08:08 +0000 (09:08 +0200)
committerKefu Chai <tchaikov@gmail.com>
Wed, 31 Aug 2022 12:36:53 +0000 (20:36 +0800)
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 <branto@redhat.com>
(cherry picked from commit ff1941a8d34f52ca25c31e9945f3591feb304b55)

src/librados/librados_c.cc

index 979dc10fd56358977201930b1139ece26d10a2b1..5d9bdb7b23dd452b085d0f815ab771515c19a26f 100644 (file)
 #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 "@")))