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 <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2025-01-16 13:43:43 +01:00 committed by Carles Cufí
commit ab26ecce6e
2 changed files with 8 additions and 1 deletions

View file

@ -5202,7 +5202,11 @@ function(zephyr_iterable_section)
endif() endif()
if(SECTION_NUMERIC) 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() else()
set(INPUT "._${SECTION_NAME}.static.*") set(INPUT "._${SECTION_NAME}.static.*")
endif() endif()

View file

@ -21,6 +21,9 @@
_CONCAT(_##struct_type, _list_start) = .; \ _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.*_???_*))); \
KEEP(*(SORT(._##struct_type.static.*_????_*))); \
KEEP(*(SORT(._##struct_type.static.*_?????_*))); \
_CONCAT(_##struct_type, _list_end) = . _CONCAT(_##struct_type, _list_end) = .
#define Z_LINK_ITERABLE_ALIGNED(struct_type, align) \ #define Z_LINK_ITERABLE_ALIGNED(struct_type, align) \