[init] switch the init hook system to __start __stop style symbols

This commit is contained in:
Travis Geiselbrecht
2020-05-15 00:00:50 -07:00
parent 243975bbce
commit c6ee887e96
4 changed files with 4 additions and 14 deletions

View File

@@ -60,7 +60,7 @@ struct lk_init_struct {
};
#define LK_INIT_HOOK_FLAGS(_name, _hook, _level, _flags) \
const struct lk_init_struct _init_struct_##_name __ALIGNED(sizeof(void *)) __SECTION(".lk_init") = { \
const struct lk_init_struct _init_struct_##_name __ALIGNED(sizeof(void *)) __SECTION("lk_init") = { \
.level = _level, \
.flags = _flags, \
.hook = _hook, \

View File

@@ -25,8 +25,8 @@
#define EARLIEST_TRACE_LEVEL LK_INIT_LEVEL_TARGET_EARLY
#endif
extern const struct lk_init_struct __lk_init[];
extern const struct lk_init_struct __lk_init_end[];
extern const struct lk_init_struct __start_lk_init __WEAK;
extern const struct lk_init_struct __stop_lk_init __WEAK;
void lk_init_level(enum lk_init_flags required_flag, uint start_level, uint stop_level) {
LTRACEF("flags %#x, start_level %#x, stop_level %#x\n",
@@ -41,7 +41,7 @@ void lk_init_level(enum lk_init_flags required_flag, uint start_level, uint stop
const struct lk_init_struct *found = NULL;
bool seen_last = false;
for (const struct lk_init_struct *ptr = __lk_init; ptr != __lk_init_end; ptr++) {
for (const struct lk_init_struct *ptr = &__start_lk_init; ptr != &__stop_lk_init; ptr++) {
LTRACEF("looking at %p (%s) level %#x, flags %#x, seen_last %d\n", ptr, ptr->name, ptr->level, ptr->flags, seen_last);
if (ptr == last)

View File

@@ -1,8 +0,0 @@
SECTIONS {
.lk_init : {
__lk_init = .;
KEEP (*(.lk_init))
__lk_init_end = .;
}
}
INSERT AFTER .rodata;

View File

@@ -14,6 +14,4 @@ MODULE_SRCS := \
$(LOCAL_DIR)/init.c \
$(LOCAL_DIR)/main.c \
EXTRA_LINKER_SCRIPTS += $(LOCAL_DIR)/init.ld
include make/module.mk