init: Add protection against incorrect levels or priorities
Initialization level can be one of five predefined. Init priority is numeric from 1 to 99. If init level or priority is defined wrong, linker prints out the message and stops. Change-Id: I165a32ffb668cda983fd48eb2aa7b94998e31a18 Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
This commit is contained in:
parent
e7bb2b8032
commit
fb6de2d486
4 changed files with 22 additions and 0 deletions
|
@ -136,6 +136,11 @@ SECTIONS {
|
|||
DEVICE_INIT_SECTIONS()
|
||||
} GROUP_LINK_IN(RAMABLE_REGION)
|
||||
|
||||
SECTION_PROLOGUE(initlevel_error, (OPTIONAL),)
|
||||
{
|
||||
DEVICE_INIT_UNDEFINED_SECTION()
|
||||
}
|
||||
ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")
|
||||
|
||||
__data_ram_end = .;
|
||||
|
||||
|
|
|
@ -156,6 +156,12 @@ SECTIONS
|
|||
DEVICE_INIT_SECTIONS()
|
||||
} GROUP_LINK_IN(RAMABLE_REGION)
|
||||
|
||||
SECTION_PROLOGUE(initlevel_error, (OPTIONAL),)
|
||||
{
|
||||
DEVICE_INIT_UNDEFINED_SECTION()
|
||||
}
|
||||
ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")
|
||||
|
||||
SECTION_PROLOGUE (_k_task_list, (OPTIONAL),)
|
||||
{
|
||||
_k_task_list_start = .;
|
||||
|
|
|
@ -128,6 +128,12 @@ SECTIONS
|
|||
KEXEC_PGALIGN_PAD(MMU_PAGE_SIZE)
|
||||
} GROUP_LINK_IN(RAM)
|
||||
|
||||
SECTION_PROLOGUE(initlevel_error, (OPTIONAL),)
|
||||
{
|
||||
DEVICE_INIT_UNDEFINED_SECTION()
|
||||
}
|
||||
ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")
|
||||
|
||||
SECTION_PROLOGUE(_k_task_list, ALIGN(4), ALIGN(4))
|
||||
{
|
||||
_k_task_list_start = .;
|
||||
|
|
|
@ -71,6 +71,11 @@
|
|||
DEVICE_INIT_LEVEL(APPLICATION) \
|
||||
__device_init_end = .; \
|
||||
|
||||
|
||||
/* define a section for undefined device initialization levels */
|
||||
#define DEVICE_INIT_UNDEFINED_SECTION() \
|
||||
KEEP(*(SORT(.init_[_A-Z0-9]*))) \
|
||||
|
||||
#ifdef CONFIG_X86 /* LINKER FILES: defines used by linker script */
|
||||
/* Should be moved to linker-common-defs.h */
|
||||
#if defined(CONFIG_XIP)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue