package/gcc: add symver attribute support to MicroBlaze
PATCH 1/1 package/gcc: add symver attribute support to MicroBlaze
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.
Signed-off-by Vincent Fazio <[email protected]>
---
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
package/gcc/11.4.0/0008-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch new file +57 -0
@@ -0,0 +1,57 @@ +From 99873bdc294aabd19861786f51c6be01ecaee59c Mon Sep 17 00:00:00 2001 +From: Vincent Fazio <[email protected]> +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 <[email protected]> +--- + 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 +
package/gcc/12.3.0/0004-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch new file +57 -0
57 lines not on this page · raw message
package/gcc/13.2.0/0003-microblaze-define-ASM_OUTPUT_SYMVER_DIRECTIVE.patch new file +57 -0
57 lines not on this page · raw message
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot