[asterisk-dev] gnu_ld dependecy for modules embedding
russell at digium.com
Fri Jun 1 20:53:24 MST 2007
Caio Begotti wrote:
> Hi, what exact parameters and features [for 1.4.x] are only found in
> GNU/ld? I noticed that this dependency was added for modules embedding
> in 1.4.x because of some compatibility issue but I didn't find what
> exactly was the reason. Is it something very specific that the Mach
> object linker of OSX isn't capable of?
Kevin wrote a linker script that only works with GNU ld to help fix an
interesting bug with embedded modules.
The bug was this: When using loadable modules, when you unload and load a
module again, all of the static variables are reinitialized. However, with
embedded modules, when you "unload" a module, it is not actually unloaded from
memory. The unload() callback function is simply called. Then, if the module
gets loaded again, the load() callback is called. However, since the module
never left memory, the static data is not reinitialized.
If anyone is interested in exactly how this fix works, I encourage you to look
at the script, build_tools/make_linker_eo_script, as well as the function
__backup_globals() in include/asterisk/module.h. It is too late for me to try
to accurately explain it. :)
More information about the asterisk-dev