Message ID | 20221224044616.3909215-1-ende.tan@starfivetech.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/1] package/libkcapi: Fix symver build error on non-ELF platforms | expand |
On Sat, 24 Dec 2022 12:46:16 +0800 Tan En De <ende.tan@starfivetech.com> wrote: > 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 Applied to master, thanks. This macro AC_CHECK_ATTRIBUTE_SYMVER is actually very good, and I believe a few other packages in Buildroot could potentially benefit from it. Thomas
Hi Stephan Müller, > -----Original Message----- > From: Stephan Müller <smueller@chronox.de> > Sent: Wednesday, 28 December, 2022 3:39 AM > To: buildroot@buildroot.org; EnDe Tan <ende.tan@starfivetech.com> > Cc: EnDe Tan <ende.tan@starfivetech.com> > Subject: Re: [1/1] package/libkcapi: Fix symver build error on non-ELF > platforms > > Am Samstag, 24. Dezember 2022, 05:46:16 CET schrieb Tan En De: > > Hi Tan, > > > > 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. > > Can you please help me what you want me to do? Does the patch you > provided not work for you? Nothing to do, I Cc'd you just to inform that I submitted this Buildroot patch corresponding to my merged pull request that day (https://github.com/smuellerDD/libkcapi/pull/147). Thanks :-)
>>>>> "Tan" == Tan En De <ende.tan@starfivetech.com> writes: > 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> Committed to 2022.11.x, thanks.
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 +