Skip to contentSkip to conversation

package/libkcapi: Fix symver build error on non-ELF platforms

PATCH Applied Tan En De 3 participants 4 messages Dec 24, 2022 – Jan 2, 2023 1 message not in the archive

lore
Share & tools
lore

Tan En De

author
#0 lore raw

PATCH 1/1 package/libkcapi: 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

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

---
 ...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
package/libkcapi/0003-Fix-symver-build-error-on-non-ELF-platforms.patch new file +84 -0
new file mode 100644
index 0000000000..206ac7ec4a
@@ -0,0 +1,84 @@
+From f630ed1f807e26de04b3a5dfd7f1b39d1c5cb642 Mon Sep 17 00:00:00 2001
+From: Tan En De <[email protected]>
+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 <[email protected]>
+Signed-off-by: Stephan Mueller <[email protected]>
+---
+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
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 12 lines · On Sat, 24 Dec 2022 12:46:16 +0800 Tan En De <[email protected]> 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

Quoted 6 lines
---
 ...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

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#3 lore raw

Hi Stephan Müller,

Quoted 13 lines

-----Original Message-----
From: Stephan Müller <[email protected]>
Sent: Wednesday, 28 December, 2022 3:39 AM
To: [email protected]; EnDe Tan <[email protected]>
Cc: EnDe Tan <[email protected]>
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,

Quoted 8 lines
Quoted 5 lines

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 :-)
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Tan En De
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Tan" == Tan En De <[email protected]> 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.

Quoted 7 lines

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

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

Committed to 2022.11.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot