Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: Sen Hastings <sen@phobosdpl.com>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>,
	buildroot@buildroot.org, Romain Naour <romain.naour@gmail.com>,
	Giulio Benetti <giulio.benetti@benettiengineering.com>,
	Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>,
	Norbert Lange <nolange79@gmail.com>
Subject: Re: [Buildroot] [PATCH v2, 2/2] package/attr: affected by gcc bug 101766
Date: Tue, 6 Feb 2024 16:11:52 +0100	[thread overview]
Message-ID: <20240206161152.0e178414@windsurf> (raw)
In-Reply-To: <20240116065831.9471-2-fontaine.fabrice@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]

Hello Fabrice,

On Tue, 16 Jan 2024 07:58:31 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> attr is affected by gcc bug 101766 since version 1.5.2 and
> https://git.savannah.nongnu.org/cgit/attr.git/commit/?id=11b9069098b4d4c23efb06c9457a085b784354d4
> resulting in the following build failure on microblaze since commit
> b31b91296e7f985b909f104f06a098adddef1fea:
> 
> libattr/syscalls.c:133:10: error: symver is only supported on ELF platforms
>   133 | # pragma GCC visibility pop
>       |          ^~~
> 
> So let's disable package attr and packages depending on it.
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/29c76e02becedf922bd7dc0533338c078bf77d2a
> 
> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

I don't like this very much. It's annoying to propagate this dependency
to all reverse dependencies of attr, and make it unavailable on
Microblaze for this silly reason. So I came up with the attached patch
for attr, which rather detects if __attribute__(__symver__) works or
not, and fall backs to another mechanism if not (this fallback already
exists in the attr code).

Could you have a look at my proposal, and if it suits you, submit it
upstream and as a patch to Buildroot ? :-)

(Yeah, I know I'm pushing some of the work for you, my goal is to be
able to continue review/merge other patches)

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com

[-- Attachment #2: 0001-configure.ac-add-detection-of-symver-gcc-attribute.patch --]
[-- Type: text/x-patch, Size: 1668 bytes --]

From 1be7c2251040f1152de9ceb5263e6e96fa5c3d75 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Tue, 6 Feb 2024 15:33:15 +0100
Subject: [PATCH] configure.ac: add detection of symver gcc attribute

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 configure.ac       | 15 +++++++++++++++
 libattr/syscalls.c |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 7e362e9..98477b5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,6 +57,21 @@ AS_CASE([$host_os],
 	[linux*], [os_linux=yes])
 AM_CONDITIONAL([OS_LINUX], [test "x$os_linux" = "xyes"])
 
+AC_CACHE_CHECK(whether __attribute__((__symver__())) is supported,
+	gcc_cv_symver_attribute,
+	[cat > conftest.c <<EOF
+void foo (void) {}
+__typeof(foo) foo __attribute__ ((__symver__("foo@foo")));
+EOF
+	gcc_cv_symver_attribute=no
+	if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then \
+	    gcc_cv_symver_attribute=yes
+	fi
+	rm -f conftest.[cs]
+])
+AS_IF([test $gcc_cv_symver_attribute = yes],
+      [AC_DEFINE(HAVE_SYMVER_ATTRIBUTE, [], [GCC supports symver attribute])])
+
 AC_CONFIG_COMMANDS([include/attr],
 	[dnl
 	rm -rf include/attr
diff --git a/libattr/syscalls.c b/libattr/syscalls.c
index 907560a..caa70bc 100644
--- a/libattr/syscalls.c
+++ b/libattr/syscalls.c
@@ -32,7 +32,7 @@
  * fall back to traditional .symver asm directive otherwise.
  */
 #ifdef __has_attribute
-# if __has_attribute(__symver__)
+# if defined(HAVE_SYMVER_ATTRIBUTE)
 #  define SYMVER(cn, vn) __typeof(cn) cn __attribute__((__symver__(vn)))
 # elif __has_attribute(__no_reorder__)
    /*
-- 
2.43.0


[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

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

  reply	other threads:[~2024-02-06 15:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16  6:58 [Buildroot] [PATCH v2, 1/2] toolchain: add BR2_TOOLCHAIN_HAS_GCC_BUG_101766 Fabrice Fontaine
2024-01-16  6:58 ` [Buildroot] [PATCH v2, 2/2] package/attr: affected by gcc bug 101766 Fabrice Fontaine
2024-02-06 15:11   ` Thomas Petazzoni via buildroot [this message]
2024-02-06 15:20     ` Giulio Benetti
2024-02-06 15:54     ` [Buildroot] [PATCH] package/attr: fix build failure on Microblaze architecture Giulio Benetti
2024-02-06 16:05       ` [Buildroot] [External] - " Vincent Fazio
2024-02-06 16:15         ` Giulio Benetti
2024-02-06 16:25         ` Thomas Petazzoni via buildroot
2024-02-06 16:38           ` Vincent Fazio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240206161152.0e178414@windsurf \
    --to=buildroot@buildroot.org \
    --cc=fontaine.fabrice@gmail.com \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=nolange79@gmail.com \
    --cc=romain.naour@gmail.com \
    --cc=sen@phobosdpl.com \
    --cc=thomas.de_schampheleire@nokia.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox