From ab26ecce6e21eacf15a9ae423551ba6d0459f9d4 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Thu, 16 Jan 2025 13:43:43 +0100 Subject: [PATCH] linker: iterable_section: Allow numeric sorting up to 5 numeric characters This allows using a uint16_t value to sort iterable sections. Signed-off-by: Pieter De Gendt --- cmake/modules/extensions.cmake | 6 +++++- include/zephyr/linker/iterable_sections.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 411398b0ae8..c63412cd16e 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -5202,7 +5202,11 @@ function(zephyr_iterable_section) endif() if(SECTION_NUMERIC) - set(INPUT "._${SECTION_NAME}.static.*_?_*;._${SECTION_NAME}.static.*_??_*") + set(INPUT "._${SECTION_NAME}.static.*_?_*;" + "._${SECTION_NAME}.static.*_??_*;" + "._${SECTION_NAME}.static.*_???_*;" + "._${SECTION_NAME}.static.*_????_*;" + "._${SECTION_NAME}.static.*_?????_*") else() set(INPUT "._${SECTION_NAME}.static.*") endif() diff --git a/include/zephyr/linker/iterable_sections.h b/include/zephyr/linker/iterable_sections.h index 3eb4e9527b8..d61d73c89d0 100644 --- a/include/zephyr/linker/iterable_sections.h +++ b/include/zephyr/linker/iterable_sections.h @@ -21,6 +21,9 @@ _CONCAT(_##struct_type, _list_start) = .; \ KEEP(*(SORT(._##struct_type.static.*_?_*))); \ KEEP(*(SORT(._##struct_type.static.*_??_*))); \ + KEEP(*(SORT(._##struct_type.static.*_???_*))); \ + KEEP(*(SORT(._##struct_type.static.*_????_*))); \ + KEEP(*(SORT(._##struct_type.static.*_?????_*))); \ _CONCAT(_##struct_type, _list_end) = . #define Z_LINK_ITERABLE_ALIGNED(struct_type, align) \