diff --git a/include/device.h b/include/device.h index 1df010d7a55..3b81213e72c 100644 --- a/include/device.h +++ b/include/device.h @@ -1040,7 +1040,7 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts"); COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \ const Z_DECL_ALIGN(struct device) \ DEVICE_NAME_GET(dev_name) __used \ - __attribute__((__section__(".device_" #level STRINGIFY(prio)))) = { \ + __attribute__((__section__(".device_" #level STRINGIFY(prio)"_"))) = { \ .name = drv_name, \ .config = (cfg_ptr), \ .api = (api_ptr), \ diff --git a/include/init.h b/include/init.h index 6fe49730e84..403885f5c1c 100644 --- a/include/init.h +++ b/include/init.h @@ -85,7 +85,7 @@ void z_sys_init_run_level(int32_t _level); #define Z_INIT_ENTRY_DEFINE(_entry_name, _init_fn, _device, _level, _prio) \ static const Z_DECL_ALIGN(struct init_entry) \ _CONCAT(__init_, _entry_name) __used \ - __attribute__((__section__(".init_" #_level STRINGIFY(_prio)))) = { \ + __attribute__((__section__(".init_" #_level STRINGIFY(_prio)"_"))) = { \ .init = (_init_fn), \ .dev = (_device), \ } diff --git a/include/linker/linker-defs.h b/include/linker/linker-defs.h index 2fb73bfd787..9a64d71a3c9 100644 --- a/include/linker/linker-defs.h +++ b/include/linker/linker-defs.h @@ -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