From: Matt Fleming Date: Fri, 15 Apr 2011 20:10:55 +0000 (+0100) Subject: elflink: Don't require every module to have init/exit functions X-Git-Tag: syslinux-5.00-pre1~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6456cf91b527376b08afe1949f4db3fe3e31d638;p=platform%2Fupstream%2Fsyslinux.git elflink: Don't require every module to have init/exit functions Don't complain or refuse to load a module if it doesn't contain an init or exit function, as many of the init/exit functions are in fact empty. Signed-off-by: Matt Fleming --- diff --git a/com32/lib/sys/module/elf_module.c b/com32/lib/sys/module/elf_module.c index afb5b64..8db4220 100644 --- a/com32/lib/sys/module/elf_module.c +++ b/com32/lib/sys/module/elf_module.c @@ -390,27 +390,20 @@ static int extract_operations(struct elf_module *module) { Elf32_Sym *exit_sym = module_find_symbol(MODULE_ELF_EXIT_PTR, module); Elf32_Sym *main_sym = module_find_symbol("main", module); - if (init_sym == NULL) { - DBG_PRINT("Cannot find initialization routine pointer.\n"); - printf("Cannot find initialization routine pointer.\n"); - return -1; - } - if (exit_sym == NULL) { - DBG_PRINT("Cannot find exit routine pointer.\n"); - printf("Cannot find exit routine pointer.\n"); - return -1; - } - - module->init_func = (module_init_t*)module_get_absolute( - init_sym->st_value, module); - if (*(module->init_func) == NULL) { - module->init_func = NULL; + if (init_sym) { + module->init_func = (module_init_t*)module_get_absolute( + init_sym->st_value, module); + if (*(module->init_func) == NULL) { + module->init_func = NULL; + } } - module->exit_func = (module_exit_t*)module_get_absolute( - exit_sym->st_value, module); - if (*(module->exit_func) == NULL) { - module->exit_func = NULL; + if (exit_sym) { + module->exit_func = (module_exit_t*)module_get_absolute( + exit_sym->st_value, module); + if (*(module->exit_func) == NULL) { + module->exit_func = NULL; + } } if (main_sym)