CPP: fix static objects init for MWDT toolchain
The constructors of static objects are stored in ".ctors" section. In case of MWDT toolchain we have incompatible ".ctors" section format with GNU toolchain. So let's use initialization code provided by MWDT instead of Zephyr one in case of MWDT toolchain usage. As it is done for GNU toolchain We call constructors of static objects but we don't call destructors for them. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
This commit is contained in:
parent
3682eb9714
commit
497cb2e587
7 changed files with 69 additions and 8 deletions
|
@ -94,6 +94,13 @@ SECTIONS {
|
|||
#include <linker/kobject-text.ld>
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
|
||||
/* .init section with code iterating over static objects constructors */
|
||||
SECTION_PROLOGUE(.init,,ALIGN(4)) {
|
||||
KEEP(*(.init*))
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
|
||||
|
||||
_image_text_end = .;
|
||||
_image_rodata_start = .;
|
||||
|
||||
|
@ -111,6 +118,13 @@ SECTIONS {
|
|||
#include <snippets-rodata.ld>
|
||||
|
||||
#include <linker/kobject-rom.ld>
|
||||
|
||||
#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
|
||||
. = ALIGN(4);
|
||||
_fctors = .;
|
||||
KEEP(*(.ctors*))
|
||||
_ectors = .;
|
||||
#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
#ifdef __MWDT_LINKER_CMD__
|
||||
|
@ -225,6 +239,11 @@ SECTIONS {
|
|||
}
|
||||
|
||||
/DISCARD/ : {
|
||||
#if defined(CONFIG_CPLUSPLUS) && !defined(CONFIG_CPP_STATIC_INIT_GNU) && defined(__MWDT_LINKER_CMD__)
|
||||
*(.dtors*)
|
||||
*(.fini*)
|
||||
*(.eh_frame*)
|
||||
#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
|
||||
*(.note.GNU-stack)
|
||||
*(.got.plt)
|
||||
*(.igot.plt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue