Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze
@ 2024-02-28 16:53 Vincent Fazio
  2026-11-23 17:30 ` Angelo Compagnucci
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Fazio @ 2024-02-28 16:53 UTC (permalink / raw)
  To: buildroot; +Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni, Vincent Fazio

While the MicroBlaze architecture does generate ELFs, it does not
leverage elfos.h to define common attributes; symver being one of them.

By adding symver support, there should no longer be any need to patch
packages to account for this architecture quirk.

Fixes: http://autobuild.buildroot.org/results/29c76e02becedf922bd7dc0533338c078bf77d2a
Fixes: http://autobuild.buildroot.net/results/1e9/1e965d83d75615f35308440c5db044314a349357

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
Tested by: 
* revert 4b34b8ccfa5159d643ecbac12c42c638e3b27e5e
* make qemu_microblazeel_mmu_defconfig
* add CONFIG_TMPFS_XATTR=y to kernel config

~/development/buildroot $ ./output/host/bin/microblazeel-buildroot-linux-gnu-readelf -W --dyn-syms output/target/usr/lib/libattr.so | grep "@ATTR"
    43: 0000355c   824 FUNC    GLOBAL DEFAULT   12 attr_listf@@ATTR_1.2
    44: 00002bf4   340 FUNC    GLOBAL DEFAULT   12 attr_getf@@ATTR_1.0
    45: 00002a80   372 FUNC    GLOBAL DEFAULT   12 attr_get@@ATTR_1.0
    46: 00001a20  1716 FUNC    GLOBAL DEFAULT   12 attr_copy_fd@@ATTR_1.1
    47: 00002fe8   272 FUNC    GLOBAL DEFAULT   12 attr_remove@@ATTR_1.0
    48: 00003894   340 FUNC    GLOBAL DEFAULT   12 attr_multi@@ATTR_1.0
    49: 000020d4  1708 FUNC    GLOBAL DEFAULT   12 attr_copy_file@@ATTR_1.1
    50: 00003cb0    72 FUNC    GLOBAL DEFAULT   12 fgetxattr@ATTR_1.0
    51: 00003dc4    64 FUNC    GLOBAL DEFAULT   12 removexattr@ATTR_1.0
    52: 00003b88    76 FUNC    GLOBAL DEFAULT   12 lsetxattr@ATTR_1.0
    53: 00003cf8    68 FUNC    GLOBAL DEFAULT   12 listxattr@ATTR_1.0
    54: 000030f8   240 FUNC    GLOBAL DEFAULT   12 attr_removef@@ATTR_1.0
    56: 00002ea8   320 FUNC    GLOBAL DEFAULT   12 attr_setf@@ATTR_1.0
    57: 00003bd4    76 FUNC    GLOBAL DEFAULT   12 fsetxattr@ATTR_1.0
    60: 000039e8   340 FUNC    GLOBAL DEFAULT   12 attr_multif@@ATTR_1.0
    61: 00003c20    72 FUNC    GLOBAL DEFAULT   12 getxattr@ATTR_1.0
    63: 0000195c   196 FUNC    GLOBAL DEFAULT   12 attr_copy_check_permissions@@ATTR_1.1
    64: 00003e04    64 FUNC    GLOBAL DEFAULT   12 lremovexattr@ATTR_1.0
    65: 00003d3c    68 FUNC    GLOBAL DEFAULT   12 llistxattr@ATTR_1.0
    66: 00002d48   352 FUNC    GLOBAL DEFAULT   12 attr_set@@ATTR_1.0
    67: 00003b3c    76 FUNC    GLOBAL DEFAULT   12 setxattr@ATTR_1.0
    68: 00001448  1300 FUNC    GLOBAL DEFAULT   12 attr_copy_action@@ATTR_1.3
    69: 00003c68    72 FUNC    GLOBAL DEFAULT   12 lgetxattr@ATTR_1.0
    70: 000031e8   884 FUNC    GLOBAL DEFAULT   12 attr_list@@ATTR_1.2
    71: 00003d80    68 FUNC    GLOBAL DEFAULT   12 flistxattr@ATTR_1.0
    72: 00003e44    64 FUNC    GLOBAL DEFAULT   12 fremovexattr@ATTR_1.0


# touch /tmp/file.txt
# attr -S -s "someattr" -V "value" /tmp/file.txt
Attribute "someattr" set to a 5 byte value for /tmp/file.txt:
value
# attr -l /tmp/file.txt
Attribute "someattr" has a 5 byte value for /tmp/file.txt
# getfattr -dm - /tmp/file.txt
getfattr: Removing leading '/' from absolute path names
# file: tmp/file.txt
security.someattr="value"
---
 ...e-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch | 57 +++++++++++++++++++
 ...e-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch | 57 +++++++++++++++++++
 ...e-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch | 57 +++++++++++++++++++
 3 files changed, 171 insertions(+)
 create mode 100644 package/gcc/11.4.0/0008-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
 create mode 100644 package/gcc/12.3.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
 create mode 100644 package/gcc/13.2.0/0003-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch

diff --git a/package/gcc/11.4.0/0008-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch b/package/gcc/11.4.0/0008-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
new file mode 100644
index 0000000000..ade50e512d
--- /dev/null
+++ b/package/gcc/11.4.0/0008-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
@@ -0,0 +1,57 @@
+From 99873bdc294aabd19861786f51c6be01ecaee59c Mon Sep 17 00:00:00 2001
+From: Vincent Fazio <vfazio@xes-inc.com>
+Date: Tue, 20 Feb 2024 16:49:06 -0600
+Subject: [PATCH] microblaze: define ASM_OUTPUT_SYMVER_DIRECTIVE
+
+The MicroBlaze target architecture generates ELF binary objects, however
+it does not leverage elfos.h like other ELF generating architectures
+(see gcc/config.gcc).
+
+Due to this quirk, the architecture does not receive "free" updates for
+new features that get added for ELF objects. One such feature being
+symver support [0].
+
+Now, the macro necessary to emit symver directives is defined.
+
+Packages such as attr, xz, libkcapi, et al which use this directive
+should now compile on MicroBlaze without needing a patch to account
+for this lack of support.
+
+This patch has not been submitted upstream as discussion [1] around
+the approach has leaned toward a full migration to elfos.h which is
+non-trivial.
+
+[0]: https://github.com/gcc-mirror/gcc/commit/d7ddfbcb7
+[1]: https://gcc.gnu.org/pipermail/gcc/2023-February/240752.html
+Upstream-bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766
+Upstream: Not Submitted
+Signed-off-by: Vincent Fazio <vfazio@gmail.com>
+---
+ gcc/config/microblaze/microblaze.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
+index 2ecec750526..e4452acddb9 100644
+--- a/gcc/config/microblaze/microblaze.h
++++ b/gcc/config/microblaze/microblaze.h
+@@ -833,6 +833,17 @@ do {									 \
+       fputc ('\n', FILE);						\
+     } while (0)
+ 
++#define ASM_OUTPUT_SYMVER_DIRECTIVE(FILE, NAME, NAME2)		\
++  do								\
++    {								\
++      fputs ("\t.symver\t", (FILE));				\
++      assemble_name ((FILE), (NAME));				\
++      fputs (", ", (FILE));					\
++      assemble_name ((FILE), (NAME2));				\
++      fputc ('\n', (FILE));					\
++    }								\
++  while (0)
++
+ #define MAKE_DECL_ONE_ONLY(DECL)	(DECL_WEAK (DECL) = 1)
+ #undef UNIQUE_SECTION_P
+ #define UNIQUE_SECTION_P(DECL)		(DECL_ONE_ONLY (DECL))
+-- 
+2.34.1
+
diff --git a/package/gcc/12.3.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch b/package/gcc/12.3.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
new file mode 100644
index 0000000000..ade50e512d
--- /dev/null
+++ b/package/gcc/12.3.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
@@ -0,0 +1,57 @@
+From 99873bdc294aabd19861786f51c6be01ecaee59c Mon Sep 17 00:00:00 2001
+From: Vincent Fazio <vfazio@xes-inc.com>
+Date: Tue, 20 Feb 2024 16:49:06 -0600
+Subject: [PATCH] microblaze: define ASM_OUTPUT_SYMVER_DIRECTIVE
+
+The MicroBlaze target architecture generates ELF binary objects, however
+it does not leverage elfos.h like other ELF generating architectures
+(see gcc/config.gcc).
+
+Due to this quirk, the architecture does not receive "free" updates for
+new features that get added for ELF objects. One such feature being
+symver support [0].
+
+Now, the macro necessary to emit symver directives is defined.
+
+Packages such as attr, xz, libkcapi, et al which use this directive
+should now compile on MicroBlaze without needing a patch to account
+for this lack of support.
+
+This patch has not been submitted upstream as discussion [1] around
+the approach has leaned toward a full migration to elfos.h which is
+non-trivial.
+
+[0]: https://github.com/gcc-mirror/gcc/commit/d7ddfbcb7
+[1]: https://gcc.gnu.org/pipermail/gcc/2023-February/240752.html
+Upstream-bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766
+Upstream: Not Submitted
+Signed-off-by: Vincent Fazio <vfazio@gmail.com>
+---
+ gcc/config/microblaze/microblaze.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
+index 2ecec750526..e4452acddb9 100644
+--- a/gcc/config/microblaze/microblaze.h
++++ b/gcc/config/microblaze/microblaze.h
+@@ -833,6 +833,17 @@ do {									 \
+       fputc ('\n', FILE);						\
+     } while (0)
+ 
++#define ASM_OUTPUT_SYMVER_DIRECTIVE(FILE, NAME, NAME2)		\
++  do								\
++    {								\
++      fputs ("\t.symver\t", (FILE));				\
++      assemble_name ((FILE), (NAME));				\
++      fputs (", ", (FILE));					\
++      assemble_name ((FILE), (NAME2));				\
++      fputc ('\n', (FILE));					\
++    }								\
++  while (0)
++
+ #define MAKE_DECL_ONE_ONLY(DECL)	(DECL_WEAK (DECL) = 1)
+ #undef UNIQUE_SECTION_P
+ #define UNIQUE_SECTION_P(DECL)		(DECL_ONE_ONLY (DECL))
+-- 
+2.34.1
+
diff --git a/package/gcc/13.2.0/0003-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch b/package/gcc/13.2.0/0003-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
new file mode 100644
index 0000000000..ade50e512d
--- /dev/null
+++ b/package/gcc/13.2.0/0003-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
@@ -0,0 +1,57 @@
+From 99873bdc294aabd19861786f51c6be01ecaee59c Mon Sep 17 00:00:00 2001
+From: Vincent Fazio <vfazio@xes-inc.com>
+Date: Tue, 20 Feb 2024 16:49:06 -0600
+Subject: [PATCH] microblaze: define ASM_OUTPUT_SYMVER_DIRECTIVE
+
+The MicroBlaze target architecture generates ELF binary objects, however
+it does not leverage elfos.h like other ELF generating architectures
+(see gcc/config.gcc).
+
+Due to this quirk, the architecture does not receive "free" updates for
+new features that get added for ELF objects. One such feature being
+symver support [0].
+
+Now, the macro necessary to emit symver directives is defined.
+
+Packages such as attr, xz, libkcapi, et al which use this directive
+should now compile on MicroBlaze without needing a patch to account
+for this lack of support.
+
+This patch has not been submitted upstream as discussion [1] around
+the approach has leaned toward a full migration to elfos.h which is
+non-trivial.
+
+[0]: https://github.com/gcc-mirror/gcc/commit/d7ddfbcb7
+[1]: https://gcc.gnu.org/pipermail/gcc/2023-February/240752.html
+Upstream-bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766
+Upstream: Not Submitted
+Signed-off-by: Vincent Fazio <vfazio@gmail.com>
+---
+ gcc/config/microblaze/microblaze.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
+index 2ecec750526..e4452acddb9 100644
+--- a/gcc/config/microblaze/microblaze.h
++++ b/gcc/config/microblaze/microblaze.h
+@@ -833,6 +833,17 @@ do {									 \
+       fputc ('\n', FILE);						\
+     } while (0)
+ 
++#define ASM_OUTPUT_SYMVER_DIRECTIVE(FILE, NAME, NAME2)		\
++  do								\
++    {								\
++      fputs ("\t.symver\t", (FILE));				\
++      assemble_name ((FILE), (NAME));				\
++      fputs (", ", (FILE));					\
++      assemble_name ((FILE), (NAME2));				\
++      fputc ('\n', (FILE));					\
++    }								\
++  while (0)
++
+ #define MAKE_DECL_ONE_ONLY(DECL)	(DECL_WEAK (DECL) = 1)
+ #undef UNIQUE_SECTION_P
+ #define UNIQUE_SECTION_P(DECL)		(DECL_ONE_ONLY (DECL))
+-- 
+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] 8+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze
  2024-02-28 16:53 [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze Vincent Fazio
@ 2026-11-23 17:30 ` Angelo Compagnucci
  2026-11-23 17:44   ` Vincent Fazio
  0 siblings, 1 reply; 8+ messages in thread
From: Angelo Compagnucci @ 2026-11-23 17:30 UTC (permalink / raw)
  To: buildroot
  Cc: Vincent Fazio, Giulio Benetti, Romain Naour, Thomas Petazzoni,
	Neal Frager, Ibai Erkiaga

Hi Vincent,

On 28/02/24 17:53, Vincent Fazio wrote:
> By adding symver support, there should no longer be any need to patch
> packages to account for this architecture quirk.

I think this patch can be dropped:

1. GCC 11.4.0, 12.3.0 and 13.2.0 are gone: master has 14.4.0, 15.3.0
   and 16.2.0.
2. The affected packages now handle MicroBlaze themselves: attr 2.6.0
   and libkcapi 1.5.0 check the symver attribute in configure, xz
   5.8.4 disables it on MicroBlaze. Buildroot dropped its attr patch
   in c804ebff55 ("package/attr: security bump version to 2.6.0").
3. The GCC change is not upstream, and upstream GCC still lacks
   symver support for MicroBlaze.

Not Applicable: https://patchwork.buildroot.org/project/buildroot/patch/20240228165300.4158751-1-vfazio@gmail.com/
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze
  2026-11-23 17:30 ` Angelo Compagnucci
@ 2026-11-23 17:44   ` Vincent Fazio
  2026-11-23 20:09     ` Angelo Compagnucci
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Fazio @ 2026-11-23 17:44 UTC (permalink / raw)
  To: Angelo Compagnucci, buildroot@buildroot.org
  Cc: Vincent Fazio, Giulio Benetti, Romain Naour, Thomas Petazzoni,
	Neal Frager, Ibai Erkiaga

All,


> -----Original Message-----
> From: buildroot <buildroot-bounces@buildroot.org> On Behalf Of Angelo
> Compagnucci
> Sent: Monday, November 23, 2026 11:30 AM
> To: buildroot@buildroot.org
> Cc: Vincent Fazio <vfazio@gmail.com>; Giulio Benetti
> <giulio.benetti@benettiengineering.com>; Romain Naour
> <romain.naour@gmail.com>; Thomas Petazzoni
> <thomas.petazzoni@bootlin.com>; Neal Frager <neal.frager@amd.com>; Ibai
> Erkiaga <ibai.erkiaga-elorza@amd.com>
> Subject: [External] - Re: [Buildroot] [PATCH 1/1] package/gcc: add symver
> attribute support to MicroBlaze
> 
> Hi Vincent,
> 
> On 28/02/24 17:53, Vincent Fazio wrote:
> > By adding symver support, there should no longer be any need to patch
> > packages to account for this architecture quirk.
> 
> I think this patch can be dropped:
> 
> 1. GCC 11.4.0, 12.3.0 and 13.2.0 are gone: master has 14.4.0, 15.3.0
>    and 16.2.0.
> 2. The affected packages now handle MicroBlaze themselves: attr 2.6.0
>    and libkcapi 1.5.0 check the symver attribute in configure, xz
>    5.8.4 disables it on MicroBlaze. Buildroot dropped its attr patch
>    in c804ebff55 ("package/attr: security bump version to 2.6.0").
> 3. The GCC change is not upstream, and upstream GCC still lacks
>    symver support for MicroBlaze.

IMO working around this for every package is not the best long term solution. 

I have, admittedly, failed to upstream the patch to GCC in the past 3 years. When I sent an email to the list [0][1], they seemed opened to the idea however.

There was discussion about refactoring MicroBlaze to use elfos.h but that's a much bigger change than the minimum needed here.

I don't necessarily need to be the one to carry this across the finish line, however. 

If the maintainers are willing to continue rediscovering this issue for new packages and fixing it similarly, it seems fine to drop this.

[0]: https://gcc.gnu.org/pipermail/gcc/2023-February/240747.html
[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766


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

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

* Re: [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze
  2026-11-23 17:44   ` Vincent Fazio
@ 2026-11-23 20:09     ` Angelo Compagnucci
  2026-11-23 20:57       ` Thomas Petazzoni via buildroot
  2026-11-23 22:35       ` Vincent Fazio
  0 siblings, 2 replies; 8+ messages in thread
From: Angelo Compagnucci @ 2026-11-23 20:09 UTC (permalink / raw)
  To: buildroot
  Cc: Vincent Fazio, Vincent Fazio, Giulio Benetti, Romain Naour,
	Thomas Petazzoni, Neal Frager, Ibai Erkiaga

Hi Vincent,

On 23/11/26 18:44, Vincent Fazio wrote:
> IMO working around this for every package is not the best long term solution.

You are right. Fixing GCC once is better than fixing every package
that hits the problem, now and in the future. I take back my proposal
to drop the patch.

If you agree, I can respin it on top of the GCC versions in master
(14.4.0, 15.3.0 and 16.2.0), keeping you as the author.

Changes Requested: https://patchwork.buildroot.org/project/buildroot/patch/20240228165300.4158751-1-vfazio@gmail.com/
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze
  2026-11-23 20:09     ` Angelo Compagnucci
@ 2026-11-23 20:57       ` Thomas Petazzoni via buildroot
  2026-11-23 22:35       ` Vincent Fazio
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-11-23 20:57 UTC (permalink / raw)
  To: Angelo Compagnucci
  Cc: buildroot, Vincent Fazio, Vincent Fazio, Giulio Benetti,
	Romain Naour, Neal Frager, Ibai Erkiaga

On Mon, Nov 23, 2026 at 09:09:51PM +0100, Angelo Compagnucci wrote:

> Changes Requested: https://patchwork.buildroot.org/project/buildroot/patch/20240228165300.4158751-1-vfazio@gmail.com/

Patch status updated!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze
  2026-11-23 20:09     ` Angelo Compagnucci
  2026-11-23 20:57       ` Thomas Petazzoni via buildroot
@ 2026-11-23 22:35       ` Vincent Fazio
  2026-11-24  8:59         ` [Buildroot] [PATCH v2 1/2] " Angelo Compagnucci
  1 sibling, 1 reply; 8+ messages in thread
From: Vincent Fazio @ 2026-11-23 22:35 UTC (permalink / raw)
  To: Angelo Compagnucci
  Cc: buildroot, Vincent Fazio, Giulio Benetti, Romain Naour,
	Thomas Petazzoni, Neal Frager, Ibai Erkiaga


[-- Attachment #1.1: Type: text/plain, Size: 733 bytes --]

Angelo,

On Mon, Nov 23, 2026, 14:09 Angelo Compagnucci <angelo.compagnucci@gmail.com>
wrote:

> Hi Vincent,
>
> On 23/11/26 18:44, Vincent Fazio wrote:
> > IMO working around this for every package is not the best long term
> solution.
>
> You are right. Fixing GCC once is better than fixing every package
> that hits the problem, now and in the future. I take back my proposal
> to drop the patch.
>
> If you agree, I can respin it on top of the GCC versions in master
> (14.4.0, 15.3.0 and 16.2.0), keeping you as the author.
>


Sounds good to me! Sorry if my other email came off as short, this patch
has been on the back burner for way too long and I've just never had the
time to get this submitted so I'm glad this came up.

[-- Attachment #1.2: Type: text/html, Size: 1156 bytes --]

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

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

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

* [Buildroot] [PATCH v2 1/2] package/gcc: add symver attribute support to MicroBlaze
  2026-11-23 22:35       ` Vincent Fazio
@ 2026-11-24  8:59         ` Angelo Compagnucci
  2026-11-24  8:59           ` [Buildroot] [PATCH v2 2/2] package/elfutils: drop the microblaze workaround Angelo Compagnucci
  0 siblings, 1 reply; 8+ messages in thread
From: Angelo Compagnucci @ 2026-11-24  8:59 UTC (permalink / raw)
  To: buildroot
  Cc: Vincent Fazio, Vincent Fazio, Giulio Benetti, Romain Naour,
	Thomas Petazzoni, Neal Frager, Ibai Erkiaga, Angelo Compagnucci

From: Vincent Fazio <vfazio@gmail.com>

While the MicroBlaze architecture does generate ELFs, it does not
leverage elfos.h to define common attributes; symver being one of them.

By adding symver support, there should no longer be any need to patch
packages to account for this architecture quirk.

Fixes: https://autobuild.buildroot.net/results/29c/29c76e02becedf922bd7dc0533338c078bf77d2a/
Fixes: https://autobuild.buildroot.net/results/1e9/1e965d83d75615f35308440c5db044314a349357/
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
Changes v1 -> v2:
  - rebase on GCC 14.4.0, 15.3.0 and 16.2.0, the versions in master
  - Upstream: tag points to the bug report comment with the patch
  - autobuild URLs in the current form, in the trailer block

Supersedes v1: https://patchwork.buildroot.org/project/buildroot/patch/20240228165300.4158751-1-vfazio@gmail.com/

 ...e-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch | 56 +++++++++++++++++++
 ...e-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch | 56 +++++++++++++++++++
 ...e-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch | 56 +++++++++++++++++++
 3 files changed, 168 insertions(+)
 create mode 100644 package/gcc/14.4.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
 create mode 100644 package/gcc/15.3.0/0005-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
 create mode 100644 package/gcc/16.2.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch

diff --git a/package/gcc/14.4.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch b/package/gcc/14.4.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
new file mode 100644
index 0000000000..51459f5763
--- /dev/null
+++ b/package/gcc/14.4.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
@@ -0,0 +1,56 @@
+From 99873bdc294aabd19861786f51c6be01ecaee59c Mon Sep 17 00:00:00 2001
+From: Vincent Fazio <vfazio@xes-inc.com>
+Date: Tue, 20 Feb 2024 16:49:06 -0600
+Subject: [PATCH] microblaze: define ASM_OUTPUT_SYMVER_DIRECTIVE
+
+The MicroBlaze target architecture generates ELF binary objects, however
+it does not leverage elfos.h like other ELF generating architectures
+(see gcc/config.gcc).
+
+Due to this quirk, the architecture does not receive "free" updates for
+new features that get added for ELF objects. One such feature being
+symver support [0].
+
+Now, the macro necessary to emit symver directives is defined.
+
+Packages such as attr, xz, libkcapi, et al which use this directive
+should now compile on MicroBlaze without needing a patch to account
+for this lack of support.
+
+This patch has not been submitted upstream as discussion [1] around
+the approach has leaned toward a full migration to elfos.h which is
+non-trivial.
+
+[0]: https://github.com/gcc-mirror/gcc/commit/d7ddfbcb7
+[1]: https://gcc.gnu.org/pipermail/gcc/2023-February/240752.html
+Upstream: suggested in the bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766#c6
+Signed-off-by: Vincent Fazio <vfazio@gmail.com>
+---
+ gcc/config/microblaze/microblaze.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
+index c88a87c..e0847e4 100644
+--- a/gcc/config/microblaze/microblaze.h
++++ b/gcc/config/microblaze/microblaze.h
+@@ -832,6 +832,17 @@ do {									 \
+       fputc ('\n', FILE);						\
+     } while (0)
+ 
++#define ASM_OUTPUT_SYMVER_DIRECTIVE(FILE, NAME, NAME2)		\
++  do								\
++    {								\
++      fputs ("\t.symver\t", (FILE));				\
++      assemble_name ((FILE), (NAME));				\
++      fputs (", ", (FILE));					\
++      assemble_name ((FILE), (NAME2));				\
++      fputc ('\n', (FILE));					\
++    }								\
++  while (0)
++
+ #define MAKE_DECL_ONE_ONLY(DECL)	(DECL_WEAK (DECL) = 1)
+ #undef UNIQUE_SECTION_P
+ #define UNIQUE_SECTION_P(DECL)		(DECL_ONE_ONLY (DECL))
+-- 
+2.43.0
+
diff --git a/package/gcc/15.3.0/0005-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch b/package/gcc/15.3.0/0005-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
new file mode 100644
index 0000000000..519fe8673c
--- /dev/null
+++ b/package/gcc/15.3.0/0005-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
@@ -0,0 +1,56 @@
+From 99873bdc294aabd19861786f51c6be01ecaee59c Mon Sep 17 00:00:00 2001
+From: Vincent Fazio <vfazio@xes-inc.com>
+Date: Tue, 20 Feb 2024 16:49:06 -0600
+Subject: [PATCH] microblaze: define ASM_OUTPUT_SYMVER_DIRECTIVE
+
+The MicroBlaze target architecture generates ELF binary objects, however
+it does not leverage elfos.h like other ELF generating architectures
+(see gcc/config.gcc).
+
+Due to this quirk, the architecture does not receive "free" updates for
+new features that get added for ELF objects. One such feature being
+symver support [0].
+
+Now, the macro necessary to emit symver directives is defined.
+
+Packages such as attr, xz, libkcapi, et al which use this directive
+should now compile on MicroBlaze without needing a patch to account
+for this lack of support.
+
+This patch has not been submitted upstream as discussion [1] around
+the approach has leaned toward a full migration to elfos.h which is
+non-trivial.
+
+[0]: https://github.com/gcc-mirror/gcc/commit/d7ddfbcb7
+[1]: https://gcc.gnu.org/pipermail/gcc/2023-February/240752.html
+Upstream: suggested in the bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766#c6
+Signed-off-by: Vincent Fazio <vfazio@gmail.com>
+---
+ gcc/config/microblaze/microblaze.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
+index 2390542..59f8a53 100644
+--- a/gcc/config/microblaze/microblaze.h
++++ b/gcc/config/microblaze/microblaze.h
+@@ -829,6 +829,17 @@ do {									 \
+       fputc ('\n', FILE);						\
+     } while (0)
+ 
++#define ASM_OUTPUT_SYMVER_DIRECTIVE(FILE, NAME, NAME2)		\
++  do								\
++    {								\
++      fputs ("\t.symver\t", (FILE));				\
++      assemble_name ((FILE), (NAME));				\
++      fputs (", ", (FILE));					\
++      assemble_name ((FILE), (NAME2));				\
++      fputc ('\n', (FILE));					\
++    }								\
++  while (0)
++
+ #define MAKE_DECL_ONE_ONLY(DECL)	(DECL_WEAK (DECL) = 1)
+ #undef UNIQUE_SECTION_P
+ #define UNIQUE_SECTION_P(DECL)		(DECL_ONE_ONLY (DECL))
+-- 
+2.43.0
+
diff --git a/package/gcc/16.2.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch b/package/gcc/16.2.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
new file mode 100644
index 0000000000..408a05c533
--- /dev/null
+++ b/package/gcc/16.2.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch
@@ -0,0 +1,56 @@
+From 99873bdc294aabd19861786f51c6be01ecaee59c Mon Sep 17 00:00:00 2001
+From: Vincent Fazio <vfazio@xes-inc.com>
+Date: Tue, 20 Feb 2024 16:49:06 -0600
+Subject: [PATCH] microblaze: define ASM_OUTPUT_SYMVER_DIRECTIVE
+
+The MicroBlaze target architecture generates ELF binary objects, however
+it does not leverage elfos.h like other ELF generating architectures
+(see gcc/config.gcc).
+
+Due to this quirk, the architecture does not receive "free" updates for
+new features that get added for ELF objects. One such feature being
+symver support [0].
+
+Now, the macro necessary to emit symver directives is defined.
+
+Packages such as attr, xz, libkcapi, et al which use this directive
+should now compile on MicroBlaze without needing a patch to account
+for this lack of support.
+
+This patch has not been submitted upstream as discussion [1] around
+the approach has leaned toward a full migration to elfos.h which is
+non-trivial.
+
+[0]: https://github.com/gcc-mirror/gcc/commit/d7ddfbcb7
+[1]: https://gcc.gnu.org/pipermail/gcc/2023-February/240752.html
+Upstream: suggested in the bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766#c6
+Signed-off-by: Vincent Fazio <vfazio@gmail.com>
+---
+ gcc/config/microblaze/microblaze.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
+index 8d1bcba..53d8245 100644
+--- a/gcc/config/microblaze/microblaze.h
++++ b/gcc/config/microblaze/microblaze.h
+@@ -829,6 +829,17 @@ do {									 \
+       fputc ('\n', FILE);						\
+     } while (0)
+ 
++#define ASM_OUTPUT_SYMVER_DIRECTIVE(FILE, NAME, NAME2)		\
++  do								\
++    {								\
++      fputs ("\t.symver\t", (FILE));				\
++      assemble_name ((FILE), (NAME));				\
++      fputs (", ", (FILE));					\
++      assemble_name ((FILE), (NAME2));				\
++      fputc ('\n', (FILE));					\
++    }								\
++  while (0)
++
+ #define MAKE_DECL_ONE_ONLY(DECL)	(DECL_WEAK (DECL) = 1)
+ #undef UNIQUE_SECTION_P
+ #define UNIQUE_SECTION_P(DECL)		(DECL_ONE_ONLY (DECL))
+-- 
+2.43.0
+
-- 
2.53.0

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

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

* [Buildroot] [PATCH v2 2/2] package/elfutils: drop the microblaze workaround
  2026-11-24  8:59         ` [Buildroot] [PATCH v2 1/2] " Angelo Compagnucci
@ 2026-11-24  8:59           ` Angelo Compagnucci
  0 siblings, 0 replies; 8+ messages in thread
From: Angelo Compagnucci @ 2026-11-24  8:59 UTC (permalink / raw)
  To: buildroot
  Cc: Vincent Fazio, Vincent Fazio, Giulio Benetti, Romain Naour,
	Thomas Petazzoni, Neal Frager, Ibai Erkiaga, Angelo Compagnucci

8ef2bb4437 ("package/elfutils: fix build on microblaze") disabled
symbol versioning on MicroBlaze, because GCC didn't support the symver
attribute there:

  dwelf_elf_begin.c:62:1: error: symver is only supported on ELF platforms

Commit "package/gcc: add symver attribute support to MicroBlaze" adds
symver support to the MicroBlaze GCC. Drop the workaround. The Bootlin
toolchains get the fix when they are rebuilt with it.

Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
Changes v1 -> v2:
  - new patch: drop the workaround the GCC fix makes useless

 package/elfutils/elfutils.mk | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/package/elfutils/elfutils.mk b/package/elfutils/elfutils.mk
index 65ac15e64a..0c038a7f2f 100644
--- a/package/elfutils/elfutils.mk
+++ b/package/elfutils/elfutils.mk
@@ -45,10 +45,6 @@ ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
 ELFUTILS_CONF_OPTS += --disable-symbol-versioning
 endif
 
-ifeq ($(BR2_microblaze),y)
-ELFUTILS_CONF_OPTS += --disable-symbol-versioning
-endif
-
 ifeq ($(BR2_PACKAGE_ELFUTILS_LIBDEBUGINFOD),y)
 ELFUTILS_CONF_OPTS += --enable-libdebuginfod
 ELFUTILS_DEPENDENCIES += json-c libcurl
-- 
2.53.0

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

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

end of thread, other threads:[~2026-11-24  8:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-28 16:53 [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze Vincent Fazio
2026-11-23 17:30 ` Angelo Compagnucci
2026-11-23 17:44   ` Vincent Fazio
2026-11-23 20:09     ` Angelo Compagnucci
2026-11-23 20:57       ` Thomas Petazzoni via buildroot
2026-11-23 22:35       ` Vincent Fazio
2026-11-24  8:59         ` [Buildroot] [PATCH v2 1/2] " Angelo Compagnucci
2026-11-24  8:59           ` [Buildroot] [PATCH v2 2/2] package/elfutils: drop the microblaze workaround Angelo Compagnucci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox