asterisk/build_tools/cflags.xml

136 lines
6.2 KiB
XML
Raw Normal View History

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">
<member name="DONT_OPTIMIZE" displayname="Disable Optimizations by the Compiler">
build_system: Split COMPILE_DOUBLE from DONT_OPTIMIZE I can't ever recall actually needing the intermediate files or the checking that a double compile produces. What I CAN remember is every DONT_OPTIMIZE build needing 3 invocations of gcc instead of 1 just to do the checks and produce those intermediate files. Having said that, Richard pointed out that the reason for the double compile was that there were cases in the past where a submitted patch failed to compile because the submitter never tried it with the optimizations turned on. To get the best of both worlds, COMPILE_DOUBLE has been split into its own option. If DONT_OPTIMIZE is turned on, COMPILE_DOUBLE will also be selected BUT you can then turn it off if all you need are the debugging symbols. This way you have to make an informed decision about disabling COMPILE_DOUBLE. To allow COMPILE_DOUBLE to be both auto-selected and turned off, a new feature was added to menuselect. The <use> element can now contain an "autoselect" attribute which will turn the used member on but not create a hard dependency. The cflags.xml implementation for COMPILE_DOUBLE looks like this... <member name="DONT_OPTIMIZE" displayname="Disable Optimizations ..."> <use autoselect="yes">COMPILE_DOUBLE</use> <support_level>core</support_level> </member> <member name="COMPILE_DOUBLE" displayname="Pre-compile with ...> <depend>DONT_OPTIMIZE</depend> <support_level>core</support_level> </member> When DONT_OPTIMIZE is turned on, COMPILE_DOUBLE is turned on because of the use. When DONT_OPTIMIZE is turned off, COMPILE_DOUBLE is turned off because of the depend. When COMPILE_DOUBLE is turned on, DONT_OPTIMIZE is turned on because of the depend. When COMPILE_DOUBLE is turned off, DONT_OPTIMIZE is left as is because it only uses COMPILE_DOUBLE, it doesn't depend on it. I also made a few tweaks to the ncurses implementation to move things left a bit to allow longer descriptions. Change-Id: Id49ca930ac4b5ec4fc2d8141979ad888da7b1611
2016-03-12 22:02:20 +00:00
<use autoselect="yes">COMPILE_DOUBLE</use>
<support_level>core</support_level>
</member>
<member name="COMPILE_DOUBLE" displayname="Pre-compile with optimizations to detect errors, then discard and recompile with DONT_OPTIMIZE. Creates intermediate .i files">
<depend>DONT_OPTIMIZE</depend>
<support_level>core</support_level>
</member>
<member name="DEBUG_THREADS" displayname="Enable Thread Debugging">
<support_level>core</support_level>
</member>
<member name="REF_DEBUG" displayname="Enable reference count debugging by default">
<support_level>extended</support_level>
</member>
<member name="AO2_DEBUG" displayname="Enable internal Astobj2 debugging">
<support_level>extended</support_level>
</member>
<member name="DEBUG_FD_LEAKS" displayname="Enable File Descriptor Leak Detection">
<support_level>core</support_level>
</member>
<member name="REBUILD_PARSERS" displayname="Rebuild AEL and expression parsers from bison/flex source files">
<depend>bison</depend>
<depend>flex</depend>
<defaultenabled>no</defaultenabled>
<support_level>extended</support_level>
</member>
<member name="LOW_MEMORY" displayname="Optimize for Low Memory Usage">
<support_level>extended</support_level>
</member>
<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>
<member name="BETTER_BACKTRACES" displayname="Use libbfd (GPL) to generate better inline backtraces">
<depend>BFD</depend>
<depend>DLADDR</depend>
<defaultenabled>no</defaultenabled>
<support_level>core</support_level>
</member>
<member name="USE_HOARD_ALLOCATOR" displayname="Use the Hoard Memory Allocator instead of the default system one">
<defaultenabled>no</defaultenabled>
<depend>hoard</depend>
<support_level>extended</support_level>
</member>
<member name="LOTS_OF_SPANS" displayname="More than 32 DAHDI spans">
<support_level>core</support_level>
</member>
<member name="RADIO_RELAX" displayname="Relax DTMF for Radio Applications">
<support_level>extended</support_level>
</member>
<member name="G711_NEW_ALGORITHM" displayname="Use the NEW ulaw/alaw codecs (slower, but cleaner)">
<defaultenabled>no</defaultenabled>
<support_level>extended</support_level>
</member>
<member name="G711_REDUCED_BRANCHING" displayname="New ulaw/alaw codec, reduced branching (might help it run faster in some architectures)">
<depend>G711_NEW_ALGORITHM</depend>
<support_level>extended</support_level>
</member>
<member name="TEST_CODING_TABLES" displayname="New ulaw/alaw codec, turn on table tests on init">
<depend>G711_NEW_ALGORITHM</depend>
<support_level>extended</support_level>
</member>
<member name="TEST_TANDEM_TRANSCODING" displayname="New ulaw/alaw codec, turn on transcoding tests on init">
<depend>G711_NEW_ALGORITHM</depend>
<support_level>extended</support_level>
</member>
<member name="MALLOC_DEBUG" displayname="Keep Track of Memory Allocations">
<support_level>core</support_level>
</member>
<member name="DEBUG_CHAOS" displayname="Randomly FAIL memory allocations or other operations">
<support_level>core</support_level>
</member>
<member name="ADDRESS_SANITIZER" displayname="Address Sanitizer">
<depend>HAVE_ADDRESS_SANITIZER</depend>
<support_level>extended</support_level>
<conflict>THREAD_SANITIZER</conflict>
<conflict>LEAK_SANITIZER</conflict>
<conflict>MALLOC_DEBUG</conflict>
<conflict>DEBUG_CHAOS</conflict>
</member>
<member name="THREAD_SANITIZER" displayname="Thread Sanitizer">
<depend>HAVE_THREAD_SANITIZER</depend>
<support_level>extended</support_level>
<conflict>ADDRESS_SANITIZER</conflict>
<conflict>LEAK_SANITIZER</conflict>
</member>
<member name="LEAK_SANITIZER" displayname="Leak Sanitizer">
<depend>HAVE_LEAK_SANITIZER</depend>
<support_level>extended</support_level>
<conflict>ADDRESS_SANITIZER</conflict>
<conflict>THREAD_SANITIZER</conflict>
<conflict>MALLOC_DEBUG</conflict>
<conflict>DEBUG_CHAOS</conflict>
</member>
<member name="UNDEFINED_SANITIZER" displayname="Undefined Behavior Sanitizer">
<depend>HAVE_UNDEFINED_SANITIZER</depend>
<support_level>extended</support_level>
</member>
<member name="BUSYDETECT_TONEONLY" displayname="Enable additional comparision of only the tone duration not the silence part">
<conflict>BUSYDETECT_COMPARE_TONE_AND_SILENCE</conflict>
<defaultenabled>no</defaultenabled>
<support_level>extended</support_level>
</member>
<member name="BUSYDETECT_COMPARE_TONE_AND_SILENCE" displayname="Assume that tone and silence have the same duration">
<conflict>BUSYDETECT_TONEONLY</conflict>
<defaultenabled>no</defaultenabled>
<support_level>extended</support_level>
</member>
<member name="BUSYDETECT_DEBUG" displayname="Enable additional busy detection debugging">
<defaultenabled>no</defaultenabled>
<support_level>extended</support_level>
</member>
<member name="INTEGER_CALLERID" displayname="Use the (less accurate) integer-based method for decoding FSK tones (for embedded systems)">
<support_level>extended</support_level>
</member>
<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>
make_buildopts_h, et. al. Allow adding all cflags to buildopts.h The previous behavior of make_buildopts_h was to not add the non-ABI-breaking MENUSELECT_CFLAGS like DETECT_DEADLOCKS, REF_DEBUG, etc. to the buildopts.h file because "it caused ccache to invalidate files and extended compile times". They're only defined by passing them on the gcc command line with '-D' options. In practice, including them in the include file rarely causes any impact because the only time ccache cares is if you actually change an option so the hit occurrs only once after you change it. OK so why would we want to include them? Many IDEs follow the include files to resolve defines and if the options aren't in an include file, it can cause the IDE to mark blocks of "ifdeffed" code as unused when they're really not. So... * Added a new menuselect compile option ADD_CFLAGS_TO_BUILDOPTS_H which tells make_buildopts_h to include the non-ABI-breaking flags in buildopts.h as well as the ABI-breaking ones. The default is disabled to preserve current behavior. As before though, only the ABI-breaking flags appear in AST_BUILDOPTS and only those are used to calculate AST_BUILDOPT_SUM. A new AST_BUILDOPT_ALL define was created to capture all of the flags. * make_version_c was streamlined to use buildopts.h and also to create asterisk_build_opts_all[] and ast_get_build_opts_all(void) * "core show settings" now shows both AST_BUILDOPTS and AST_BUILDOPTS_ALL. UserNote: The "Build Options" entry in the "core show settings" CLI command has been renamed to "ABI related Build Options" and a new entry named "All Build Options" has been added that shows both breaking and non-breaking options.
2023-09-13 20:08:02 +00:00
<member name="ADD_CFLAGS_TO_BUILDOPTS_H" displayname="Add ALL of the flags on this page to buildopts.h. Useful for IDEs but may cause slightly longer compile times after flags are changed.">
<support_level>core</support_level>
<defaultenabled>no</defaultenabled>
</member>
</category>