elf: Support __constructor and __destructor
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 <matt.fleming@intel.com>
12 files changed: