Blame SOURCES/0001-Use-GCCs-__symver__-attribute.patch

0aea10
From 2abf7fecb5162e4b59ba134c813ebee839eb45e9 Mon Sep 17 00:00:00 2001
0aea10
From: Simo Sorce <simo@redhat.com>
0aea10
Date: Wed, 14 Jul 2021 10:52:01 -0400
0aea10
Subject: [PATCH] Use GCCs __symver__ attribute
0aea10
0aea10
This is needed to allow LTO builds, as the __asm__ directives do not give
0aea10
enough context to the compiler and the build fails when the -flto flag is
0aea10
passed in.
0aea10
0aea10
Unfotunately __symver__ is avilbel only startig from GCC 10, so we need
0aea10
more macro juggling.
0aea10
0aea10
Signed-off-by: Simo Sorce <simo@redhat.com>
0aea10
---
0aea10
 lib/internal.h | 11 +++++++++++
0aea10
 1 file changed, 11 insertions(+)
0aea10
0aea10
diff --git a/lib/internal.h b/lib/internal.h
0aea10
index 29fdb7b..64dad24 100644
0aea10
--- a/lib/internal.h
0aea10
+++ b/lib/internal.h
0aea10
@@ -350,6 +350,16 @@ static inline int io_getevents(__attribute__((unused)) aio_context_t ctx,
0aea10
 #if __GNUC__ >= 4
0aea10
 # define DSO_PUBLIC __attribute__ ((visibility ("default")))
0aea10
 
0aea10
+#if __GNUC__ >= 10
0aea10
+# define IMPL_SYMVER(name, version) \
0aea10
+    __attribute__ ((visibility ("default"))) \
0aea10
+    __attribute__((__symver__("kcapi_" #name "@@LIBKCAPI_" version)))
0aea10
+
0aea10
+# define ORIG_SYMVER(name, version) \
0aea10
+    __attribute__ ((visibility ("default"))) \
0aea10
+    __attribute__((__symver__("kcapi_" #name "@LIBKCAPI_" version)))
0aea10
+
0aea10
+#else
0aea10
 # define IMPL_SYMVER(name, version) \
0aea10
     __asm__(".global impl_" #name ";"\
0aea10
 	    ".symver impl_" #name ",kcapi_" #name "@@LIBKCAPI_" version);\
0aea10
@@ -359,6 +369,7 @@ static inline int io_getevents(__attribute__((unused)) aio_context_t ctx,
0aea10
     __asm__(".global orig_" #name ";"\
0aea10
 	    ".symver orig_" #name ",kcapi_" #name "@LIBKCAPI_" version);\
0aea10
     __attribute__ ((visibility ("default")))
0aea10
+#endif
0aea10
 
0aea10
 #else
0aea10
 # error "Compiler version too old"
0aea10
-- 
0aea10
2.31.1
0aea10