All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [1/1] package/libkcapi: Fix symver build error on non-ELF platforms
@ 2022-12-24  4:46 Tan En De
  2022-12-27 20:48 ` Thomas Petazzoni via buildroot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tan En De @ 2022-12-24  4:46 UTC (permalink / raw)
  To: buildroot; +Cc: Stephan Mueller, Tan En De

The following error is observed on Microblaze [1] build:
```
error: symver is only supported on ELF platforms
```
due to using __attribute__((symver)) on non-ELF platform.
So, revert to using .symver in such case.

[1]: http://autobuild.buildroot.net/results/447/4470efb5a078c0e368f6bd4f5ec455eea5eeebb5/build-end.log

Upstream status: commit f630ed1f807e26de04b3a5dfd7f1b39d1c5cb642
https://github.com/smuellerDD/libkcapi/pull/147

Signed-off-by: Tan En De <ende.tan@starfivetech.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
 ...ver-build-error-on-non-ELF-platforms.patch | 84 +++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 package/libkcapi/0003-Fix-symver-build-error-on-non-ELF-platforms.patch

diff --git a/package/libkcapi/0003-Fix-symver-build-error-on-non-ELF-platforms.patch b/package/libkcapi/0003-Fix-symver-build-error-on-non-ELF-platforms.patch
new file mode 100644
index 0000000000..206ac7ec4a
--- /dev/null
+++ b/package/libkcapi/0003-Fix-symver-build-error-on-non-ELF-platforms.patch
@@ -0,0 +1,84 @@
+From f630ed1f807e26de04b3a5dfd7f1b39d1c5cb642 Mon Sep 17 00:00:00 2001
+From: Tan En De <ende.tan@starfivetech.com>
+Date: Sat, 26 Nov 2022 07:47:39 +0800
+Subject: [PATCH] Fix symver build error on non-ELF platforms
+
+The following error is observed on Microblaze [1] build:
+```
+error: symver is only supported on ELF platforms
+```
+due to using __attribute__((symver)) on non-ELF platform.
+So, revert to using .symver in such case.
+
+[1]: http://autobuild.buildroot.net/results/447/4470efb5a078c0e368f6bd4f5ec455eea5eeebb5/build-end.log
+
+Signed-off-by: Tan En De <ende.tan@starfivetech.com>
+Signed-off-by: Stephan Mueller <smueller@chronox.de>
+---
+Upstream status: commit f630ed1f807e26de04b3a5dfd7f1b39d1c5cb642
+
+ configure.ac                    |  2 ++
+ lib/internal.h                  |  2 +-
+ m4/ac_check_attribute_symver.m4 | 24 ++++++++++++++++++++++++
+ 3 files changed, 27 insertions(+), 1 deletion(-)
+ create mode 100644 m4/ac_check_attribute_symver.m4
+
+diff --git a/configure.ac b/configure.ac
+index e230577..ba17404 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -76,6 +76,8 @@ AX_ADD_FORTIFY_SOURCE
+ 
+ AC_CHECK_API_VERSION
+ 
++AC_CHECK_ATTRIBUTE_SYMVER
++
+ AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror], [Disable -Werror])], [with_werror=$enableval], [with_werror=yes])
+ AM_CONDITIONAL([ENABLE_WERROR], [test "x$with_werror" = "xyes"])
+ 
+diff --git a/lib/internal.h b/lib/internal.h
+index 14844a9..7977b04 100644
+--- a/lib/internal.h
++++ b/lib/internal.h
+@@ -352,7 +352,7 @@ static inline int io_getevents(__attribute__((unused)) aio_context_t ctx,
+  * Auxiliary macros
+  ************************************************************/
+ 
+-#if __GNUC__ >= 10
++#if HAVE_ATTRIBUTE_SYMVER && __GNUC__ >= 10
+ # define IMPL_SYMVER(name, version) \
+     __attribute__((__symver__("kcapi_" #name "@@LIBKCAPI_" version)))
+ 
+diff --git a/m4/ac_check_attribute_symver.m4 b/m4/ac_check_attribute_symver.m4
+new file mode 100644
+index 0000000..b484c5e
+--- /dev/null
++++ b/m4/ac_check_attribute_symver.m4
+@@ -0,0 +1,24 @@
++dnl Check compiler support for symver function attribute
++AC_DEFUN([AC_CHECK_ATTRIBUTE_SYMVER], [
++	saved_CFLAGS=$CFLAGS
++	CFLAGS="-O0 -Werror"
++	AC_COMPILE_IFELSE(
++		[AC_LANG_PROGRAM(
++			[[
++				void _test_attribute_symver(void);
++				__attribute__((__symver__("sym@VER_1.2.3"))) void _test_attribute_symver(void) {}
++			]],
++			[[ 
++				_test_attribute_symver()
++			]]
++		)],
++		[
++			AC_DEFINE([HAVE_ATTRIBUTE_SYMVER], 1, [Define to 1 if __attribute__((symver)) is supported])
++		],
++		[
++			AC_DEFINE([HAVE_ATTRIBUTE_SYMVER], 0, [Define to 0 if __attribute__((symver)) is not supported])
++		]
++	)
++	CFLAGS=$saved_CFLAGS
++])
++
+-- 
+2.34.1
+
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-02  7:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-24  4:46 [Buildroot] [1/1] package/libkcapi: Fix symver build error on non-ELF platforms Tan En De
2022-12-27 20:48 ` Thomas Petazzoni via buildroot
     [not found] ` <2665585.mvXUDI8C0e@positron.chronox.de>
2022-12-28  1:42   ` EnDe Tan
2023-01-02  7:25 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.