aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-01-10 13:39:50 +0000
committerMatt Fleming <matt.fleming@intel.com>2013-01-10 14:02:19 +0000
commit04cf121216bf2d5c6fc9e01028519f7d655d66cf (patch)
treecebd6397915299b4ea60b92fb25df3c0adfec5c2 /com32/lib/sys
parent15d85f991bb2609aedce06c0e01d89b31c6dc008 (diff)
downloadsyslinux-04cf121216bf2d5c6fc9e01028519f7d655d66cf.tar.gz
syslinux-04cf121216bf2d5c6fc9e01028519f7d655d66cf.tar.xz
syslinux-04cf121216bf2d5c6fc9e01028519f7d655d66cf.zip
module: Allow .c32 files to execute themselves
Historically, .c32 files had to explicitly link against ldlinux.c32 in order to use its exported symbols. This lead to the undesirable situation during module dependency resolution where loading, e.g. menu.c32, would cause ldlinux.c32 to be reloaded, thus re-executing its main() function and dropping the user at a prompt instead of executing menu.c32. commit 1357b7e62706 ("elflink: Don't reload the current EXEC_MODULE module") was the solution to this problem, since you don't need to reload a module to link against it's symbols. Unfortunately, while this commit was intended to stop ldlinux.c32 being reloaded, it also broke the use case where a .c32 wants to load itself, e.g. when vesamenu.c32 wants to execute vesamenu.c32 with a different config. Luckily, modules no longer need to include ldlinux.c32 in their dependency list, since ldlinux.c32 is *always* loaded and any symbols can be automatically resolved. Which means that the check in spawn_load() can be deleted. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/lib/sys')
-rw-r--r--com32/lib/sys/module/exec.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/com32/lib/sys/module/exec.c b/com32/lib/sys/module/exec.c
index 559bafc7..ac9ca79a 100644
--- a/com32/lib/sys/module/exec.c
+++ b/com32/lib/sys/module/exec.c
@@ -203,20 +203,8 @@ int spawn_load(const char *name, int argc, char **argv)
if (!strcmp(cur_module->name, module->name)) {
dprintf("We is running this module %s already!", module->name);
- /*
- * If we're already running the module and it's of
- * type EXEC_MODULE, then just return. We don't reload
- * the module because that might cause us to re-run
- * the init functions, which will cause us to run the
- * main function, which will take control of this
- * process.
- *
- * This can happen if some other EXEC_MODULE is
- * resolving a symbol that is exported by the current
- * EXEC_MODULE.
- */
- if (get_module_type(module) == EXEC_MODULE)
- return 0;
+ module_unload(cur_module);
+ cur_module = NULL;
}
res = module_load(module);