module: Allow .c32 files to execute themselves
authorMatt Fleming <matt.fleming@intel.com>
Thu, 10 Jan 2013 13:39:50 +0000 (13:39 +0000)
committerMatt Fleming <matt.fleming@intel.com>
Thu, 10 Jan 2013 14:02:19 +0000 (14:02 +0000)
commit04cf121216bf2d5c6fc9e01028519f7d655d66cf
treecebd6397915299b4ea60b92fb25df3c0adfec5c2
parent15d85f991bb2609aedce06c0e01d89b31c6dc008
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>
com32/lib/sys/module/exec.c