diff --git a/include/linker/common-ram.ld b/include/linker/common-ram.ld index ec462b6f07e..41525be9d65 100644 --- a/include/linker/common-ram.ld +++ b/include/linker/common-ram.ld @@ -80,6 +80,7 @@ { _k_sem_list_start = .; KEEP(*("._k_sem.static.*")) + KEEP(*("._sys_sem.static.*")) _k_sem_list_end = .; } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) diff --git a/include/sys/sem.h b/include/sys/sem.h index c34354c3e23..1e02a1f0a60 100644 --- a/include/sys/sem.h +++ b/include/sys/sem.h @@ -65,8 +65,7 @@ struct sys_sem { * are identical and can be treated as a k_sem in the boot initialization code */ #define SYS_SEM_DEFINE(_name, _initial_count, _count_limit) \ - Z_DECL_ALIGN(struct sys_sem) _name \ - __in_section(_k_sem, static, _name) = { \ + Z_STRUCT_SECTION_ITERABLE(sys_sem, _name) = { \ .kernel_sem = Z_SEM_INITIALIZER(_name.kernel_sem, \ _initial_count, _count_limit) \ }; \