From 5eb53417f410328452460b3c78f21714ab3cca6e Mon Sep 17 00:00:00 2001 From: tonyzheng-rockchip Date: Fri, 3 Jan 2020 09:23:44 +0800 Subject: [PATCH] Add priority & stack_size param parsing for dlmodule --- components/libc/libdl/dlelf.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/libc/libdl/dlelf.c b/components/libc/libdl/dlelf.c index 1265ffcb07..b79e5c23ea 100644 --- a/components/libc/libdl/dlelf.c +++ b/components/libc/libdl/dlelf.c @@ -226,6 +226,24 @@ rt_err_t dlmodule_load_shared_object(struct rt_dlmodule* module, void *module_pt length); count ++; } + + /* get priority param */ + for (i = 0; i < shdr[index].sh_size / sizeof(Elf32_Sym); i++) + { + if (rt_strcmp((const char *)(strtab + symtab[i].st_name), "dlmodule_thread_priority") == 0) + { + module->priority = *(rt_uint16_t*)(module->mem_space + symtab[i].st_value - module->vstart_addr); + } + } + + /* get stack size param */ + for (i = 0; i < shdr[index].sh_size / sizeof(Elf32_Sym); i++) + { + if (rt_strcmp((const char *)(strtab + symtab[i].st_name), "dlmodule_thread_stacksize") == 0) + { + module->stack_size = *(rt_uint32_t*)(module->mem_space + symtab[i].st_value - module->vstart_addr); + } + } } return RT_EOK; -- GitLab