linker-defs: Fix sorting order of objects by priority

Commit 0a7b65e tweaked the CREATE_OBJ_LEVEL macro in such a way
that it would break the expected sorting order.

For example if you had 2, 19, 20, 30 as the level, we'd end up sort
these to be 19, 2, 20, 30.

Fix this by adding aditional "_" symbol after the init level counter.
That allows to keep correct sort order (for both GNU and MWDT
toolchains) and distinguish init level counter from section suffix
(for MWDT toolchain).

Fixes zephyrproject-rtos#33464

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
This commit is contained in:
Eugeniy Paltsev 2021-03-24 13:31:08 +03:00 committed by Kumar Gala
commit e828702b6a
3 changed files with 4 additions and 4 deletions

View file

@ -116,8 +116,8 @@
*/
#define CREATE_OBJ_LEVEL(object, level) \
__##object##_##level##_start = .; \
KEEP(*(SORT(.object##_##level[0-9]*))); \
KEEP(*(SORT(.object##_##level[1-9][0-9]*)));
KEEP(*(SORT(.object##_##level[0-9]_*))); \
KEEP(*(SORT(.object##_##level[1-9][0-9]_*)));
/*
* link in shell initialization objects for all modules that use shell and