From fae6d29a3802e289cac273398e43fb7708535421 Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Sat, 8 Apr 2023 23:00:31 +0000 Subject: systemd: rebase microblaze patches Rebase/rework microblaze patches for the latest systemd version Signed-off-by: Mark Hatle --- ...e-Add-Microblaze-architecture-to-systemd-.patch | 81 +++++++++------- .../files/microblaze-disable-stack-protector.patch | 20 ++-- .../systemd/files/microblaze-once-macro.patch | 24 ++--- .../systemd/files/microblaze-syscalls.patch | 107 ++++++++++----------- 4 files changed, 121 insertions(+), 111 deletions(-) (limited to 'meta-microblaze') diff --git a/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch b/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch index 8b4f6dc8..a29214d5 100644 --- a/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch +++ b/meta-microblaze/recipes-core/systemd/files/0001-architecture-Add-Microblaze-architecture-to-systemd-.patch @@ -4,54 +4,65 @@ Date: Sun, 11 Apr 2021 20:04:06 -0700 Subject: [PATCH] Add systemd support for microblaze architecture Signed-off-by: Sai Hari Chandana Kalluri + +Applied to current version of systemd +Reworked to split microblaze and microblazeel + +Signed-off-by: Mark Hatle --- src/basic/architecture.c | 3 +++ src/basic/architecture.h | 4 ++++ 2 files changed, 7 insertions(+) -diff --git a/src/basic/architecture.c b/src/basic/architecture.c -index 85837b5..dbcefbc 100644 ---- a/src/basic/architecture.c -+++ b/src/basic/architecture.c -@@ -54,6 +54,8 @@ int uname_architecture(void) { - { "mips", ARCHITECTURE_MIPS }, +Index: git/src/basic/architecture.c +=================================================================== +--- git.orig/src/basic/architecture.c ++++ git/src/basic/architecture.c +@@ -49,6 +49,10 @@ Architecture uname_architecture(void) { #elif defined(__alpha__) { "alpha" , ARCHITECTURE_ALPHA }, -+#elif defined(__microblaze__) -+ { "microblaze" , ARCHITECTURE_MICROBLAZE }, - #elif defined(__arm__) || defined(__aarch64__) - { "aarch64", ARCHITECTURE_ARM64 }, - { "aarch64_be", ARCHITECTURE_ARM64_BE }, -@@ -173,6 +175,7 @@ static const char *const architecture_table[_ARCHITECTURE_MAX] = { - [ARCHITECTURE_RISCV64] = "riscv64", - [ARCHITECTURE_ARC] = "arc", - [ARCHITECTURE_ARC_BE] = "arc-be", -+ [ARCHITECTURE_MICROBLAZE] = "microblaze", - }; - DEFINE_STRING_TABLE_LOOKUP(architecture, int); -diff --git a/src/basic/architecture.h b/src/basic/architecture.h -index 443e890..559ada9 100644 ---- a/src/basic/architecture.h -+++ b/src/basic/architecture.h -@@ -42,6 +42,7 @@ enum { - ARCHITECTURE_NIOS2, - ARCHITECTURE_RISCV32, - ARCHITECTURE_RISCV64, ++#elif defined(__microblaze__) ++ { "microblaze", ARCHITECTURE_MICROBLAZE }, ++ { "microblazeel", ARCHITECTURE_MICROBLAZE_LE }, ++ + #elif defined(__arc__) + { "arc", ARCHITECTURE_ARC }, + { "arceb", ARCHITECTURE_ARC_BE }, +@@ -147,6 +151,8 @@ static const char *const architecture_ta + [ARCHITECTURE_ALPHA] = "alpha", + [ARCHITECTURE_ARC] = "arc", + [ARCHITECTURE_ARC_BE] = "arc-be", ++ [ARCHITECTURE_MICROBLAZE] = "microblaze", ++ [ARCHITECTURE_MICROBLAZE_LE] = "microblazeel", + [ARCHITECTURE_CRIS] = "cris", + [ARCHITECTURE_X86_64] = "x86-64", + [ARCHITECTURE_X86] = "x86", +Index: git/src/basic/architecture.h +=================================================================== +--- git.orig/src/basic/architecture.h ++++ git/src/basic/architecture.h +@@ -22,6 +22,8 @@ typedef enum { + ARCHITECTURE_IA64, + ARCHITECTURE_LOONGARCH64, + ARCHITECTURE_M68K, + ARCHITECTURE_MICROBLAZE, - ARCHITECTURE_ARC, - ARCHITECTURE_ARC_BE, - _ARCHITECTURE_MAX, -@@ -229,6 +230,9 @@ int uname_architecture(void); ++ ARCHITECTURE_MICROBLAZE_LE, + ARCHITECTURE_MIPS, + ARCHITECTURE_MIPS64, + ARCHITECTURE_MIPS64_LE, +@@ -239,6 +241,14 @@ Architecture uname_architecture(void); # define native_architecture() ARCHITECTURE_ARC # define LIB_ARCH_TUPLE "arc-linux" # endif +#elif defined(__microblaze__) -+# define native_architecture() ARCHITECTURE_MICROBLAZE -+# define LIB_ARCH_TUPLE "microblazeel-xilinx-linux" ++# if __BYTE_ORDER == __BIG_ENDIAN ++# define native_architecture() ARCHITECTURE_MICROBLAZE ++# define LIB_ARCH_TUPLE "microblaze-linux" ++# else ++# define native_architecture() ARCHITECTURE_MICROBLAZE_LE ++# define LIB_ARCH_TUPLE "microblazeel-linux" ++# endif #else # error "Please register your architecture here!" #endif --- -2.7.4 - diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch index 535f864a..ecbf1f79 100644 --- a/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-disable-stack-protector.patch @@ -5,20 +5,20 @@ Microblaze does not support stack-protector: Signed-off-by: Mark Hatle -diff --git a/meson.build b/meson.build -index 738879eb21..06ea3e389a 100644 ---- a/meson.build -+++ b/meson.build -@@ -371,7 +371,6 @@ endif - possible_link_flags = [ - '-Wl,-z,relro', +Index: git/meson.build +=================================================================== +--- git.orig/meson.build ++++ git/meson.build +@@ -403,7 +403,6 @@ possible_link_flags = [ + '-Wl,--fatal-warnings', '-Wl,-z,now', + '-Wl,-z,relro', - '-fstack-protector', ] - if cc.get_id() == 'clang' -@@ -388,8 +387,6 @@ possible_cc_flags = possible_common_cc_flags + [ - '-ffast-math', + if get_option('b_sanitize') == 'none' +@@ -423,8 +422,6 @@ possible_cc_flags = possible_common_cc_f + '-fdiagnostics-show-option', '-fno-common', '-fno-strict-aliasing', - '-fstack-protector', diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch index ae43692a..8cb618ec 100644 --- a/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-once-macro.patch @@ -9,19 +9,19 @@ worst expected behavior could be multiple log messages. Signed-off-by: Mark Hatle -diff --git a/src/fundamental/macro-fundamental.h b/src/fundamental/macro-fundamental.h -index 967518600d..44785e516b 100644 ---- a/src/fundamental/macro-fundamental.h -+++ b/src/fundamental/macro-fundamental.h -@@ -55,11 +55,28 @@ +Index: git/src/fundamental/macro-fundamental.h +=================================================================== +--- git.orig/src/fundamental/macro-fundamental.h ++++ git/src/fundamental/macro-fundamental.h +@@ -109,11 +109,28 @@ * on this macro will run concurrently to all other code conditionalized * the same way, there's no ordering or completion enforced. */ #define ONCE __ONCE(UNIQ_T(_once_, UNIQ)) +#if !defined (__microblaze__) #define __ONCE(o) \ ({ \ - static bool (o) = false; \ - __sync_bool_compare_and_swap(&(o), false, true); \ + static sd_bool (o) = sd_false; \ + __sync_bool_compare_and_swap(&(o), sd_false, sd_true); \ }) +#else + /* Microblaze does not contain __sync_bool_compare_and_swap, so we do it @@ -30,11 +30,11 @@ index 967518600d..44785e516b 100644 + * an issue. */ +#define __ONCE(o) \ + ({ \ -+ static bool (o) = false; \ -+ bool rc = false; \ -+ if ((o) == false) { \ -+ (o) = true; \ -+ rc = true; \ ++ static bool (o) = sd_false; \ ++ bool rc = sd_false; \ ++ if ((o) == sd_false) { \ ++ (o) = sd_true; \ ++ rc = sd_true; \ + } \ + rc; \ + }) diff --git a/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch b/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch index 9a1a8bd2..3bf75d32 100644 --- a/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch +++ b/meta-microblaze/recipes-core/systemd/files/microblaze-syscalls.patch @@ -2,32 +2,32 @@ Add microblaze syscalls to systemd Signed-off-by: Mark Hatle -diff --git a/src/basic/meson.build b/src/basic/meson.build -index 9b016ce5e8..a896e3c464 100644 ---- a/src/basic/meson.build -+++ b/src/basic/meson.build -@@ -332,6 +332,7 @@ arch_list = [ - 'i386', +Index: git/src/basic/meson.build +=================================================================== +--- git.orig/src/basic/meson.build ++++ git/src/basic/meson.build +@@ -347,6 +347,7 @@ arch_list = [ 'ia64', + 'loongarch64', 'm68k', + 'microblaze', 'mips64', 'mips64n32', 'mipso32', -diff --git a/src/basic/missing_syscall_def.h b/src/basic/missing_syscall_def.h -index 6a48c2a0c5..ed7df7c07d 100644 ---- a/src/basic/missing_syscall_def.h -+++ b/src/basic/missing_syscall_def.h -@@ -14,6 +14,7 @@ - # elif defined(__i386__) +Index: git/src/basic/missing_syscall_def.h +=================================================================== +--- git.orig/src/basic/missing_syscall_def.h ++++ git/src/basic/missing_syscall_def.h +@@ -16,6 +16,7 @@ # elif defined(__ia64__) + # elif defined(__loongarch64) # elif defined(__m68k__) +# elif defined(__microblaze__) # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # elif _MIPS_SIM == _MIPS_SIM_NABI32 -@@ -54,6 +55,8 @@ - # define systemd_NR_bpf 1341 +@@ -58,6 +59,8 @@ + # define systemd_NR_bpf 280 # elif defined(__m68k__) # define systemd_NR_bpf 354 +# elif defined(__microblaze__) @@ -35,8 +35,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_bpf 4355 -@@ -118,6 +121,8 @@ assert_cc(__NR_bpf == systemd_NR_bpf); - # define systemd_NR_close_range 1460 +@@ -124,6 +127,8 @@ assert_cc(__NR_bpf == systemd_NR_bpf); + # define systemd_NR_close_range 436 # elif defined(__m68k__) # define systemd_NR_close_range 436 +# elif defined(__microblaze__) @@ -44,8 +44,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_close_range 4436 -@@ -182,6 +187,8 @@ assert_cc(__NR_close_range == systemd_NR_close_range); - # define systemd_NR_copy_file_range 1347 +@@ -190,6 +195,8 @@ assert_cc(__NR_close_range == systemd_NR + # define systemd_NR_copy_file_range 285 # elif defined(__m68k__) # define systemd_NR_copy_file_range 376 +# elif defined(__microblaze__) @@ -53,8 +53,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_copy_file_range 4360 -@@ -246,6 +253,8 @@ assert_cc(__NR_copy_file_range == systemd_NR_copy_file_range); - # define systemd_NR_epoll_pwait2 1465 +@@ -256,6 +263,8 @@ assert_cc(__NR_copy_file_range == system + # define systemd_NR_epoll_pwait2 441 # elif defined(__m68k__) # define systemd_NR_epoll_pwait2 441 +# elif defined(__microblaze__) @@ -62,8 +62,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_epoll_pwait2 4441 -@@ -310,6 +319,8 @@ assert_cc(__NR_epoll_pwait2 == systemd_NR_epoll_pwait2); - # define systemd_NR_getrandom 1339 +@@ -322,6 +331,8 @@ assert_cc(__NR_epoll_pwait2 == systemd_N + # define systemd_NR_getrandom 278 # elif defined(__m68k__) # define systemd_NR_getrandom 352 +# elif defined(__microblaze__) @@ -71,8 +71,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_getrandom 4353 -@@ -374,6 +385,8 @@ assert_cc(__NR_getrandom == systemd_NR_getrandom); - # define systemd_NR_memfd_create 1340 +@@ -388,6 +399,8 @@ assert_cc(__NR_getrandom == systemd_NR_g + # define systemd_NR_memfd_create 279 # elif defined(__m68k__) # define systemd_NR_memfd_create 353 +# elif defined(__microblaze__) @@ -80,8 +80,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_memfd_create 4354 -@@ -438,6 +451,8 @@ assert_cc(__NR_memfd_create == systemd_NR_memfd_create); - # define systemd_NR_mount_setattr 1466 +@@ -454,6 +467,8 @@ assert_cc(__NR_memfd_create == systemd_N + # define systemd_NR_mount_setattr 442 # elif defined(__m68k__) # define systemd_NR_mount_setattr 442 +# elif defined(__microblaze__) @@ -89,8 +89,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_mount_setattr 4442 -@@ -502,6 +517,8 @@ assert_cc(__NR_mount_setattr == systemd_NR_mount_setattr); - # define systemd_NR_move_mount 1453 +@@ -520,6 +535,8 @@ assert_cc(__NR_mount_setattr == systemd_ + # define systemd_NR_move_mount 429 # elif defined(__m68k__) # define systemd_NR_move_mount 429 +# elif defined(__microblaze__) @@ -98,8 +98,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_move_mount 4429 -@@ -566,6 +583,8 @@ assert_cc(__NR_move_mount == systemd_NR_move_mount); - # define systemd_NR_name_to_handle_at 1326 +@@ -586,6 +603,8 @@ assert_cc(__NR_move_mount == systemd_NR_ + # define systemd_NR_name_to_handle_at 264 # elif defined(__m68k__) # define systemd_NR_name_to_handle_at 340 +# elif defined(__microblaze__) @@ -107,8 +107,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_name_to_handle_at 4339 -@@ -630,6 +649,8 @@ assert_cc(__NR_name_to_handle_at == systemd_NR_name_to_handle_at); - # define systemd_NR_open_tree 1452 +@@ -652,6 +671,8 @@ assert_cc(__NR_name_to_handle_at == syst + # define systemd_NR_open_tree 428 # elif defined(__m68k__) # define systemd_NR_open_tree 428 +# elif defined(__microblaze__) @@ -116,8 +116,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_open_tree 4428 -@@ -694,6 +715,8 @@ assert_cc(__NR_open_tree == systemd_NR_open_tree); - # define systemd_NR_pidfd_open 1458 +@@ -784,6 +805,8 @@ assert_cc(__NR_openat2 == systemd_NR_ope + # define systemd_NR_pidfd_open 434 # elif defined(__m68k__) # define systemd_NR_pidfd_open 434 +# elif defined(__microblaze__) @@ -125,8 +125,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_pidfd_open 4434 -@@ -758,6 +781,8 @@ assert_cc(__NR_pidfd_open == systemd_NR_pidfd_open); - # define systemd_NR_pidfd_send_signal 1448 +@@ -850,6 +873,8 @@ assert_cc(__NR_pidfd_open == systemd_NR_ + # define systemd_NR_pidfd_send_signal 424 # elif defined(__m68k__) # define systemd_NR_pidfd_send_signal 424 +# elif defined(__microblaze__) @@ -134,8 +134,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_pidfd_send_signal 4424 -@@ -822,6 +847,8 @@ assert_cc(__NR_pidfd_send_signal == systemd_NR_pidfd_send_signal); - # define systemd_NR_pkey_mprotect 1354 +@@ -916,6 +941,8 @@ assert_cc(__NR_pidfd_send_signal == syst + # define systemd_NR_pkey_mprotect 288 # elif defined(__m68k__) # define systemd_NR_pkey_mprotect 381 +# elif defined(__microblaze__) @@ -143,8 +143,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_pkey_mprotect 4363 -@@ -886,6 +913,8 @@ assert_cc(__NR_pkey_mprotect == systemd_NR_pkey_mprotect); - # define systemd_NR_renameat2 1338 +@@ -982,6 +1009,8 @@ assert_cc(__NR_pkey_mprotect == systemd_ + # define systemd_NR_renameat2 276 # elif defined(__m68k__) # define systemd_NR_renameat2 351 +# elif defined(__microblaze__) @@ -152,8 +152,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_renameat2 4351 -@@ -950,6 +979,8 @@ assert_cc(__NR_renameat2 == systemd_NR_renameat2); - # define systemd_NR_setns 1330 +@@ -1048,6 +1077,8 @@ assert_cc(__NR_renameat2 == systemd_NR_r + # define systemd_NR_setns 268 # elif defined(__m68k__) # define systemd_NR_setns 344 +# elif defined(__microblaze__) @@ -161,8 +161,8 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_setns 4344 -@@ -1014,6 +1045,8 @@ assert_cc(__NR_setns == systemd_NR_setns); - # define systemd_NR_statx 1350 +@@ -1114,6 +1145,8 @@ assert_cc(__NR_setns == systemd_NR_setns + # define systemd_NR_statx 291 # elif defined(__m68k__) # define systemd_NR_statx 379 +# elif defined(__microblaze__) @@ -170,12 +170,12 @@ index 6a48c2a0c5..ed7df7c07d 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_statx 4366 -diff --git a/src/basic/missing_syscalls.py b/src/basic/missing_syscalls.py -index 19f9726d4e..66fd7615b4 100644 ---- a/src/basic/missing_syscalls.py -+++ b/src/basic/missing_syscalls.py -@@ -61,6 +61,8 @@ DEF_TEMPLATE_B = '''\ - # define systemd_NR_{syscall} {nr_ia64} +Index: git/src/basic/missing_syscalls.py +=================================================================== +--- git.orig/src/basic/missing_syscalls.py ++++ git/src/basic/missing_syscalls.py +@@ -64,6 +64,8 @@ DEF_TEMPLATE_B = '''\ + # define systemd_NR_{syscall} {nr_loongarch64} # elif defined(__m68k__) # define systemd_NR_{syscall} {nr_m68k} +# elif defined(__microblaze__) @@ -183,11 +183,10 @@ index 19f9726d4e..66fd7615b4 100644 # elif defined(_MIPS_SIM) # if _MIPS_SIM == _MIPS_SIM_ABI32 # define systemd_NR_{syscall} {nr_mipso32} -diff --git a/src/basic/syscalls-microblaze.txt b/src/basic/syscalls-microblaze.txt -new file mode 100644 -index 0000000000..3fc4cd6aef +Index: git/src/basic/syscalls-microblaze.txt +=================================================================== --- /dev/null -+++ b/src/basic/syscalls-microblaze.txt ++++ git/src/basic/syscalls-microblaze.txt @@ -0,0 +1,598 @@ +_llseek 140 +_newselect 142 -- cgit v1.2.3-54-g00ecf