diff --git a/libs/libc/dlfcn/lib_dlopen.c b/libs/libc/dlfcn/lib_dlopen.c index e33cfc1e3c1..e5d43b550db 100644 --- a/libs/libc/dlfcn/lib_dlopen.c +++ b/libs/libc/dlfcn/lib_dlopen.c @@ -207,6 +207,7 @@ static inline FAR void *dlinsert(FAR const char *filename) binfo("Failed to initialize for load of ELF program: %d\n", ret); goto errout_with_loadinfo; } + memset(modp, 0, sizeof(*modp)); /* Load the program binary */ @@ -248,7 +249,7 @@ static inline FAR void *dlinsert(FAR const char *filename) /* Call the module initializer */ - if (loadinfo.ehdr.e_type == ET_REL) + if (loadinfo.ehdr.e_type == ET_REL) { ret = initializer(&modp->modinfo); if (ret < 0) diff --git a/libs/libc/machine/arm/armv7-m/arch_elf.c b/libs/libc/machine/arm/armv7-m/arch_elf.c index c52d3769a1f..737a701a089 100644 --- a/libs/libc/machine/arm/armv7-m/arch_elf.c +++ b/libs/libc/machine/arm/armv7-m/arch_elf.c @@ -496,8 +496,10 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) case R_ARM_RELATIVE : case R_ARM_JUMP_SLOT : { - binfo("Relocating: RELATIVE/JUMP_SLOT at %p value: %08lx with %08lx\n", - (void *)addr,*(unsigned long *) addr, (unsigned long) sym->st_value); + binfo("Relocating: RELATIVE/JUMP_SLOT at %p value: %08lx" + "with %08lx\n", + (void *)addr, *(unsigned long *)addr, + (unsigned long)sym->st_value); *(uint32_t *) addr = (uint32_t) sym->st_value; } break; diff --git a/libs/libc/modlib/modlib.h b/libs/libc/modlib/modlib.h index 4ace9fa3ef0..92e8a1ecd61 100644 --- a/libs/libc/modlib/modlib.h +++ b/libs/libc/modlib/modlib.h @@ -111,30 +111,30 @@ int modlib_readsym(FAR struct mod_loadinfo_s *loadinfo, int index, int modlib_symvalue(FAR struct module_s *modp, FAR struct mod_loadinfo_s *loadinfo, FAR Elf_Sym *sym, - Elf_Off offset); + Elf_Off offset); - /**************************************************************************** - * Name: modlib_insertsymtab - * - * Description: - * Insert a symbol table for the current module. - * - * Input Parameters: - * modp - Module state information - * loadinfo - Module load information - * shdr - Symbol table section header - * sym - Symbol table entry - * - * Returned Value: - * 0 (OK) is returned on success and a negated errno is returned on - * failure. - * - * ENOMEM - Symbol undefined and not provided via a symbol table - * - ****************************************************************************/ - -int modlib_insertsymtab(FAR struct module_s *modp, - FAR struct mod_loadinfo_s *loadinfo, +/**************************************************************************** + * Name: modlib_insertsymtab + * + * Description: + * Insert a symbol table for the current module. + * + * Input Parameters: + * modp - Module state information + * loadinfo - Module load information + * shdr - Symbol table section header + * sym - Symbol table entry + * + * Returned Value: + * 0 (OK) is returned on success and a negated errno is returned on + * failure. + * + * ENOMEM - Symbol undefined and not provided via a symbol table + * + ****************************************************************************/ + +int modlib_insertsymtab(FAR struct module_s *modp, + FAR struct mod_loadinfo_s *loadinfo, FAR Elf_Shdr *shdr, FAR Elf_Sym *sym); @@ -158,8 +158,8 @@ int modlib_insertsymtab(FAR struct module_s *modp, * ****************************************************************************/ -void *modlib_findglobal(FAR struct module_s *modp, - FAR struct mod_loadinfo_s *loadinfo, +void *modlib_findglobal(FAR struct module_s *modp, + FAR struct mod_loadinfo_s *loadinfo, FAR Elf_Shdr *shdr, FAR Elf_Sym *sym);