Skip to content

Commit 9b86169

Browse files
init: tweak Zephyr .init* section name conflicting with toolchain
In case of ARC MWDT toolchain and C++ support enabled the Zephyr .init* section conflicts with .init section derived from toolchain libs. Let's add 'z_' prefix to Zephyr .init* section (and therefore .device section as they share the same macros) to make Zephyr section name unique. Signed-off-by: Evgeniy Paltsev <[email protected]>
1 parent 5885239 commit 9b86169

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

include/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ BUILD_ASSERT(sizeof(device_handle_t) == 2, "fix the linker scripts");
10401040
COND_CODE_1(DT_NODE_EXISTS(node_id), (), (static)) \
10411041
const Z_DECL_ALIGN(struct device) \
10421042
DEVICE_NAME_GET(dev_name) __used \
1043-
__attribute__((__section__(".device_" #level STRINGIFY(prio)"_"))) = { \
1043+
__attribute__((__section__(".z_device_" #level STRINGIFY(prio)"_"))) = { \
10441044
.name = drv_name, \
10451045
.config = (cfg_ptr), \
10461046
.api = (api_ptr), \

include/init.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void z_sys_init_run_level(int32_t level);
8585
#define Z_INIT_ENTRY_DEFINE(_entry_name, _init_fn, _device, _level, _prio) \
8686
static const Z_DECL_ALIGN(struct init_entry) \
8787
_CONCAT(__init_, _entry_name) __used \
88-
__attribute__((__section__(".init_" #_level STRINGIFY(_prio)"_"))) = { \
88+
__attribute__((__section__(".z_init_" #_level STRINGIFY(_prio)"_"))) = { \
8989
.init = (_init_fn), \
9090
.dev = (_device), \
9191
}

include/linker/common-rom.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
3131
#endif
3232

33-
/* verify we don't have rogue .init_<something> initlevel sections */
33+
/* verify we don't have rogue .z_init_<something> initlevel sections */
3434
SECTION_PROLOGUE(initlevel_error,,)
3535
{
36-
KEEP(*(SORT(.init_[_A-Z0-9]*)))
36+
KEEP(*(SORT(.z_init_[_A-Z0-9]*)))
3737
}
3838
ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")
3939

include/linker/linker-defs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116
*/
117117
#define CREATE_OBJ_LEVEL(object, level) \
118118
__##object##_##level##_start = .; \
119-
KEEP(*(SORT(.object##_##level[0-9]_*))); \
120-
KEEP(*(SORT(.object##_##level[1-9][0-9]_*)));
119+
KEEP(*(SORT(.z_##object##_##level[0-9]_*))); \
120+
KEEP(*(SORT(.z_##object##_##level[1-9][0-9]_*)));
121121

122122
/*
123123
* link in shell initialization objects for all modules that use shell and

0 commit comments

Comments
 (0)