Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Fazio <vfazio@gmail.com>
To: buildroot@buildroot.org
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>,
	Romain Naour <romain.naour@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Vincent Fazio <vfazio@gmail.com>
Subject: [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze
Date: Wed, 28 Feb 2024 10:53:00 -0600	[thread overview]
Message-ID: <20240228165300.4158751-1-vfazio@gmail.com> (raw)

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

             reply	other threads:[~2024-02-28 16:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 16:53 Vincent Fazio [this message]
2026-11-23 17:30 ` [Buildroot] [PATCH 1/1] package/gcc: add symver attribute support to MicroBlaze 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

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=20240228165300.4158751-1-vfazio@gmail.com \
    --to=vfazio@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=romain.naour@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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