optional_api: Fix linking problems between modules that export global symbols
With the new work in Asterisk 12, there are some uses of the
optional_api that are prone to failure. The details are rather involved,
and captured on [the wiki][1].
This patch addresses the issue by removing almost all of the magic from
the optional API implementation. Instead of relying on weak symbol
resolution, a new optional_api.c module was added to Asterisk core.
For modules providing an optional API, the pointer to the implementation
function is registered with the core. For modules that use an optional
API, a pointer to a stub function, along with a optional_ref function
pointer are registered with the core. The optional_ref function pointers
is set to the implementation function when it's provided, or the stub
function when it's now.
Since the implementation no longer relies on magic, it is now supported
on all platforms. In the spirit of choice, an OPTIONAL_API flag was
added, so we can disable the optional_api if needed (maybe it's buggy on
some bizarre platform I haven't tested on)
The AST_OPTIONAL_API*() macros themselves remained unchanged, so
existing code could remain unchanged. But to help with debugging the
optional_api, the patch limits the #include of optional API's to just
the modules using the API. This also reduces resource waste maintaining
optional_ref pointers that aren't used.
Other changes made as a part of this patch:
* The stubs for http_websocket that wrap system calls set errno to
ENOSYS.
* res_http_websocket now properly increments module use count.
* In loader.c, the while() wrappers around dlclose() were removed. The
while(!dlclose()) is actually an anti-pattern, which can lead to
infinite loops if the module you're attempting to unload exports a
symbol that was directly linked to.
* The special handling of nonoptreq on systems without weak symbol
support was removed, since we no longer rely on weak symbols for
optional_api.
[1]: https://wiki.asterisk.org/wiki/x/wACUAQ
(closes issue ASTERISK-22296)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2797/
........
Merged revisions 397989 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30 13:40:27 +00:00
|
|
|
<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean">
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="DONT_OPTIMIZE" displayname="Disable Optimizations by the Compiler">
|
2012-08-18 01:14:42 +00:00
|
|
|
<support_level>core</support_level>
|
2006-04-24 17:11:45 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="DEBUG_THREADS" displayname="Enable Thread Debugging">
|
2012-08-18 01:14:42 +00:00
|
|
|
<support_level>core</support_level>
|
2007-01-04 23:18:36 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="STATIC_BUILD" displayname="Build static binaries">
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2006-04-24 17:11:45 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="LOADABLE_MODULES" displayname="Runtime module loading">
|
2007-12-26 22:38:02 +00:00
|
|
|
<defaultenabled>yes</defaultenabled>
|
2012-08-18 01:14:42 +00:00
|
|
|
<support_level>core</support_level>
|
2006-09-19 17:07:22 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="DEBUG_FD_LEAKS" displayname="Enable File Descriptor Leak Detection">
|
2012-08-18 01:14:42 +00:00
|
|
|
<support_level>core</support_level>
|
2009-04-09 04:59:05 +00:00
|
|
|
</member>
|
2010-01-25 21:38:33 +00:00
|
|
|
<member name="REBUILD_PARSERS" displayname="Rebuild AEL and expression parsers from bison/flex source files">
|
|
|
|
<depend>bison</depend>
|
|
|
|
<depend>flex</depend>
|
|
|
|
<defaultenabled>no</defaultenabled>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2010-01-25 21:38:33 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="LOW_MEMORY" displayname="Optimize for Low Memory Usage">
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2007-07-24 21:37:11 +00:00
|
|
|
</member>
|
2013-05-08 21:01:33 +00:00
|
|
|
<member name="DISABLE_INLINE" displayname="Disable the inline API">
|
|
|
|
<!-- Added to work around GCC bug
|
|
|
|
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47816
|
|
|
|
-->
|
|
|
|
<support_level>extended</support_level>
|
|
|
|
</member>
|
optional_api: Fix linking problems between modules that export global symbols
With the new work in Asterisk 12, there are some uses of the
optional_api that are prone to failure. The details are rather involved,
and captured on [the wiki][1].
This patch addresses the issue by removing almost all of the magic from
the optional API implementation. Instead of relying on weak symbol
resolution, a new optional_api.c module was added to Asterisk core.
For modules providing an optional API, the pointer to the implementation
function is registered with the core. For modules that use an optional
API, a pointer to a stub function, along with a optional_ref function
pointer are registered with the core. The optional_ref function pointers
is set to the implementation function when it's provided, or the stub
function when it's now.
Since the implementation no longer relies on magic, it is now supported
on all platforms. In the spirit of choice, an OPTIONAL_API flag was
added, so we can disable the optional_api if needed (maybe it's buggy on
some bizarre platform I haven't tested on)
The AST_OPTIONAL_API*() macros themselves remained unchanged, so
existing code could remain unchanged. But to help with debugging the
optional_api, the patch limits the #include of optional API's to just
the modules using the API. This also reduces resource waste maintaining
optional_ref pointers that aren't used.
Other changes made as a part of this patch:
* The stubs for http_websocket that wrap system calls set errno to
ENOSYS.
* res_http_websocket now properly increments module use count.
* In loader.c, the while() wrappers around dlclose() were removed. The
while(!dlclose()) is actually an anti-pattern, which can lead to
infinite loops if the module you're attempting to unload exports a
symbol that was directly linked to.
* The special handling of nonoptreq on systems without weak symbol
support was removed, since we no longer rely on weak symbols for
optional_api.
[1]: https://wiki.asterisk.org/wiki/x/wACUAQ
(closes issue ASTERISK-22296)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/2797/
........
Merged revisions 397989 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30 13:40:27 +00:00
|
|
|
<member name="OPTIONAL_API" displayname="Enable the optional API">
|
|
|
|
<!-- Added to manually disable the optional API, since
|
|
|
|
it's now supported on all systems.
|
|
|
|
-->
|
|
|
|
<defaultenabled>yes</defaultenabled>
|
|
|
|
<support_level>extended</support_level>
|
|
|
|
</member>
|
2011-08-18 14:49:28 +00:00
|
|
|
<member name="BETTER_BACKTRACES" displayname="Use libbfd (GPL) to generate better inline backtraces">
|
|
|
|
<depend>BFD</depend>
|
|
|
|
<depend>DLADDR</depend>
|
|
|
|
<defaultenabled>no</defaultenabled>
|
2012-08-18 01:14:42 +00:00
|
|
|
<support_level>core</support_level>
|
2011-08-18 14:49:28 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="USE_HOARD_ALLOCATOR" displayname="Use the Hoard Memory Allocator instead of the default system one">
|
2008-08-03 16:14:14 +00:00
|
|
|
<defaultenabled>no</defaultenabled>
|
|
|
|
<depend>hoard</depend>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2008-08-03 16:14:14 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="LOTS_OF_SPANS" displayname="More than 32 DAHDI spans">
|
2012-08-18 01:14:42 +00:00
|
|
|
<support_level>core</support_level>
|
2006-06-06 00:25:23 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="RADIO_RELAX" displayname="Relax DTMF for Radio Applications">
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2006-04-24 17:11:45 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="G711_NEW_ALGORITHM" displayname="Use the NEW ulaw/alaw codecs (slower, but cleaner)">
|
2007-08-20 22:53:48 +00:00
|
|
|
<defaultenabled>no</defaultenabled>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2007-08-20 22:53:48 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="G711_REDUCED_BRANCHING" displayname="New ulaw/alaw codec, reduced branching (might help it run faster in some architectures)">
|
2007-08-20 22:53:48 +00:00
|
|
|
<depend>G711_NEW_ALGORITHM</depend>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2007-08-20 22:53:48 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="TEST_CODING_TABLES" displayname="New ulaw/alaw codec, turn on table tests on init">
|
2007-08-20 22:53:48 +00:00
|
|
|
<depend>G711_NEW_ALGORITHM</depend>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2007-08-20 22:53:48 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="TEST_TANDEM_TRANSCODING" displayname="New ulaw/alaw codec, turn on transcoding tests on init">
|
2007-08-20 22:53:48 +00:00
|
|
|
<depend>G711_NEW_ALGORITHM</depend>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2007-08-20 22:53:48 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="MALLOC_DEBUG" displayname="Keep Track of Memory Allocations">
|
2012-08-18 01:14:42 +00:00
|
|
|
<support_level>core</support_level>
|
2006-04-24 17:11:45 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="BUSYDETECT_TONEONLY" displayname="Enable additional comparision of only the tone duration not the silence part">
|
2008-01-17 20:51:26 +00:00
|
|
|
<conflict>BUSYDETECT_COMPARE_TONE_AND_SILENCE</conflict>
|
|
|
|
<defaultenabled>no</defaultenabled>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2008-01-17 20:51:26 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="BUSYDETECT_COMPARE_TONE_AND_SILENCE" displayname="Assume that tone and silence have the same duration">
|
2008-01-17 20:51:26 +00:00
|
|
|
<conflict>BUSYDETECT_TONEONLY</conflict>
|
|
|
|
<defaultenabled>no</defaultenabled>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2008-01-17 20:51:26 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="BUSYDETECT_DEBUG" displayname="Enable additional busy detection debugging">
|
2008-01-17 20:51:26 +00:00
|
|
|
<defaultenabled>no</defaultenabled>
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2008-01-17 20:51:26 +00:00
|
|
|
</member>
|
2010-02-16 15:36:53 +00:00
|
|
|
<member name="INTEGER_CALLERID" displayname="Use the (less accurate) integer-based method for decoding FSK tones (for embedded systems)">
|
2011-09-28 20:55:42 +00:00
|
|
|
<support_level>extended</support_level>
|
2008-07-21 20:59:03 +00:00
|
|
|
</member>
|
2012-04-12 15:25:47 +00:00
|
|
|
<member name="BUILD_NATIVE" displayname="Allow compiler to generate code optimized for the CPU on which the build is performed.">
|
|
|
|
<support_level>core</support_level>
|
|
|
|
<defaultenabled>yes</defaultenabled>
|
|
|
|
<depend>native_arch</depend>
|
|
|
|
</member>
|
2006-04-24 17:11:45 +00:00
|
|
|
</category>
|