<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/syslinux.git/com32/lib/sys/module/exec.c, branch master</title>
<subtitle>git.kernel.org: pub/scm/boot/syslinux/syslinux.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/'/>
<entry>
<title>add missing '\n' to dprintf</title>
<updated>2015-05-03T14:48:39+00:00</updated>
<author>
<name>Jonathan Boeing</name>
<email>jonathan.n.boeing@gmail.com</email>
</author>
<published>2015-02-10T03:01:03+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=a66d04f09e00643aeb1ea9730b6235e352dda99f'/>
<id>a66d04f09e00643aeb1ea9730b6235e352dda99f</id>
<content type='text'>
Signed-off-by: Jonathan Boeing &lt;jonathan.n.boeing@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Jonathan Boeing &lt;jonathan.n.boeing@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>module: convert to dprintf() to aid debugging</title>
<updated>2013-07-26T15:35:59+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2013-07-26T15:35:59+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=0006a5e1bc8742fbbc6fbe52d1d12bab05eef311'/>
<id>0006a5e1bc8742fbbc6fbe52d1d12bab05eef311</id>
<content type='text'>
dprintf() is much more useful than DBG_PRINT() when trying to figure out
where a module is failing to load because we can enable the debug
statements at runtime.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
dprintf() is much more useful than DBG_PRINT() when trying to figure out
where a module is failing to load because we can enable the debug
statements at runtime.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>module: Replace cur_module with module_current()</title>
<updated>2013-01-23T15:05:29+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2013-01-23T14:46:08+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=7c42c59ebd9d33efe3a5f12542580a8c1379447d'/>
<id>7c42c59ebd9d33efe3a5f12542580a8c1379447d</id>
<content type='text'>
It's easy for cur_module and prev_module to get out of sync with
reality (the actual module that is running), so add module_current()
which returns the module at the head of the module_list, i.e. the
module that was loaded most recently. Better still, by using the list
we don't have to do any kind of stacking of module pointers ourselves.

This fixes a bug where cur_module contained a stale pointer (the
module had actually been unloaded) but the pointer value had since
been reallocated for a new module in spawn_load(), meaning that the
following check,

    if (!strcmp(cur_module-&gt;name, module-&gt;name))

was always going to be true, even though *no* module was actually
loaded at this point as we were reloading ldlinux.c32 from
start_ldlinux(). This could have been fixed with a NULL-assignment
after module_unload(), but using the modules_head list to detect the
current module is much cleaner.

Note that the core module loaded in load_env32() is always on the
list, therefore module_current() will always return a valid pointer.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It's easy for cur_module and prev_module to get out of sync with
reality (the actual module that is running), so add module_current()
which returns the module at the head of the module_list, i.e. the
module that was loaded most recently. Better still, by using the list
we don't have to do any kind of stacking of module pointers ourselves.

This fixes a bug where cur_module contained a stale pointer (the
module had actually been unloaded) but the pointer value had since
been reallocated for a new module in spawn_load(), meaning that the
following check,

    if (!strcmp(cur_module-&gt;name, module-&gt;name))

was always going to be true, even though *no* module was actually
loaded at this point as we were reloading ldlinux.c32 from
start_ldlinux(). This could have been fixed with a NULL-assignment
after module_unload(), but using the modules_head list to detect the
current module is much cleaner.

Note that the core module loaded in load_env32() is always on the
list, therefore module_current() will always return a valid pointer.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>elf: remove long-since-obsolete shallow module machinery</title>
<updated>2013-01-18T00:52:20+00:00</updated>
<author>
<name>H. Peter Anvin</name>
<email>hpa@linux.intel.com</email>
</author>
<published>2013-01-18T00:52:20+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=14fe8af6c11e71619de9be1afd4556ebbc770db3'/>
<id>14fe8af6c11e71619de9be1afd4556ebbc770db3</id>
<content type='text'>
Meant to handle symbols exported from the core, but we just
pregenerate the dynamic section instead.

Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Meant to handle symbols exported from the core, but we just
pregenerate the dynamic section instead.

Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>module: Allow .c32 files to execute themselves</title>
<updated>2013-01-10T14:02:19+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2013-01-10T13:39:50+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=04cf121216bf2d5c6fc9e01028519f7d655d66cf'/>
<id>04cf121216bf2d5c6fc9e01028519f7d655d66cf</id>
<content type='text'>
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 &lt;matt.fleming@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;matt.fleming@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ldlinux: Complain to user on failure to perform file operations</title>
<updated>2012-11-29T13:28:47+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2012-11-29T09:34:18+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=0174945b6b604425e8f576c0af0908ce00cdc493'/>
<id>0174945b6b604425e8f576c0af0908ce00cdc493</id>
<content type='text'>
If we fail to chdir or to execute a COM32 file we should inform the
user so that they can debug the problem. We don't currently print
anything if the user tries to execute a regular file, such as a config
file, as an COM32 image.

We also shouldn't be returning the exit value of the module from
spawn_load(), because we have no way of doing anything useful with it,
and just because a main() function returns -1 doesn't mean it failed
to run. Modules need to take care of printing any error messages
themselves.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we fail to chdir or to execute a COM32 file we should inform the
user so that they can debug the problem. We don't currently print
anything if the user tries to execute a regular file, such as a config
file, as an COM32 image.

We also shouldn't be returning the exit value of the module from
spawn_load(), because we have no way of doing anything useful with it,
and just because a main() function returns -1 doesn't mean it failed
to run. Modules need to take care of printing any error messages
themselves.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>module: Fix memory leak in spawn_load()</title>
<updated>2012-11-27T21:09:44+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2012-11-27T16:19:17+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=30ebd4f6bc83fa4832b658705d4020cb82dfdaea'/>
<id>30ebd4f6bc83fa4832b658705d4020cb82dfdaea</id>
<content type='text'>
If for some reason we fail to load a module then we need to free the
memory allocated to that module.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If for some reason we fail to load a module then we need to free the
memory allocated to that module.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>elf: Support __constructor and __destructor</title>
<updated>2012-03-23T16:54:47+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@intel.com</email>
</author>
<published>2012-03-22T15:31:43+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=8e0ed96bff75801f7430da88d83ea1b52827b123'/>
<id>8e0ed96bff75801f7430da88d83ea1b52827b123</id>
<content type='text'>
The old way of specifying functions that need to be run before/after a
main function has never worked for ELF modules. Instead, the only way
to get similiar behaviour was by using the MODULE_INIT() and
MODULE_EXIT() macros, but no one seems to have bothered converting the
old __constructor users over. Anyway, the old way is superior because
it allows multiple functions be specified. Delete the MODULE_* macros
as there's only one user of them in the entire tree.

We can also get rid of the UNKNOWN_MODULE constant because now a
module doesn't need a __module_init_ptr symbol to be classed as a
library - if a module isn't an executable, it's a library, there's no
such thing as an unknown type.

It's no longer necessary to explicitly call
__syslinux_get_ipappend_strings() from ldlinux.c because the
__constructor tag on the version in com32/lib/syslinux will take care
of invoking it before ldlinux.c32's main() is executed.

Also, since we've refactored unload_module() to now run a module's
destructors let's minimise the number of callers by deleting
load_library() and unload_library(), which were only called by the
test module in com32/elflink.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The old way of specifying functions that need to be run before/after a
main function has never worked for ELF modules. Instead, the only way
to get similiar behaviour was by using the MODULE_INIT() and
MODULE_EXIT() macros, but no one seems to have bothered converting the
old __constructor users over. Anyway, the old way is superior because
it allows multiple functions be specified. Delete the MODULE_* macros
as there's only one user of them in the entire tree.

We can also get rid of the UNKNOWN_MODULE constant because now a
module doesn't need a __module_init_ptr symbol to be classed as a
library - if a module isn't an executable, it's a library, there's no
such thing as an unknown type.

It's no longer necessary to explicitly call
__syslinux_get_ipappend_strings() from ldlinux.c because the
__constructor tag on the version in com32/lib/syslinux will take care
of invoking it before ldlinux.c32's main() is executed.

Also, since we've refactored unload_module() to now run a module's
destructors let's minimise the number of callers by deleting
load_library() and unload_library(), which were only called by the
test module in com32/elflink.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ldlinux: Use DT_NEEDED for module dependencies</title>
<updated>2011-06-07T14:59:58+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@linux.intel.com</email>
</author>
<published>2011-06-06T13:12:45+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=558de6072a2fae89a27d10119b3ea49a4741db16'/>
<id>558de6072a2fae89a27d10119b3ea49a4741db16</id>
<content type='text'>
The ELF file format uses DT_NEEDED entries in the dynamic section to
name any shared library dependencies. Instead of rolling our own
dependency logic via the modules.dep file and elf_gen_dep.sh script
use the DT_NEEDED entries.

Signed-off-by: Matt Fleming &lt;matt.fleming@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The ELF file format uses DT_NEEDED entries in the dynamic section to
name any shared library dependencies. Instead of rolling our own
dependency logic via the modules.dep file and elf_gen_dep.sh script
use the DT_NEEDED entries.

Signed-off-by: Matt Fleming &lt;matt.fleming@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>elflink: Move more code from core/ into ldlinux</title>
<updated>2011-04-26T08:53:31+00:00</updated>
<author>
<name>Matt Fleming</name>
<email>matt.fleming@linux.intel.com</email>
</author>
<published>2011-04-08T12:21:51+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/syslinux.git/commit/?id=43d7cbaa55806ecb33b0cc5aa56e97b0f8027c45'/>
<id>43d7cbaa55806ecb33b0cc5aa56e97b0f8027c45</id>
<content type='text'>
ldlinux now contains all the code necessary to load and execute
modules, none is contained in the core.

This change also allows us to change the spawn_load() prototype and to
push the job of processing arguments to executable functions (e.g. the
contents of char *argv[] as passed to a module's main function) into
ldlinux/execute.c instead of doing it in spawn_load(). Moving it into
ldlinux/ makes sense because the only core user of spawn_load() is
load_env32() and we don't require any sort of argument processing in
that path.

Signed-off-by: Matt Fleming &lt;matt.fleming@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
ldlinux now contains all the code necessary to load and execute
modules, none is contained in the core.

This change also allows us to change the spawn_load() prototype and to
push the job of processing arguments to executable functions (e.g. the
contents of char *argv[] as passed to a module's main function) into
ldlinux/execute.c instead of doing it in spawn_load(). Moving it into
ldlinux/ makes sense because the only core user of spawn_load() is
load_env32() and we don't require any sort of argument processing in
that path.

Signed-off-by: Matt Fleming &lt;matt.fleming@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
