]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados/librados_c: check for both symvers 42602/head
authorBoris Ranto <branto@redhat.com>
Thu, 5 Aug 2021 07:08:08 +0000 (09:08 +0200)
committerBoris Ranto <branto@redhat.com>
Thu, 5 Aug 2021 13:46:50 +0000 (15:46 +0200)
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>
src/librados/librados_c.cc

index dd1723dd5eb33d7130ba5ac38a89a48a9afa8aab..b56732b1a95aaeb5f2ac5f230e85cb02f72b2b4b 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 "@")))