[asterisk-commits] Build: Add menuselect options for using compiler sanitizers (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 15 14:40:51 CDT 2015
Joshua Colp has submitted this change and it was merged.
Change subject: Build: Add menuselect options for using compiler sanitizers
......................................................................
Build: Add menuselect options for using compiler sanitizers
This patch adds menuselect options for building Asterisk with
various sanitizers provided by gcc and clang.
When one of *SANITIZER flags is set in menuselect, the appropriate
option is added to CFLAGS ad LDFLAGS for the build.
Information on sanitizers in the project wiki:
https://github.com/google/sanitizers/wiki
GCC Manual:
https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html
Clang Compiler User's Manual:
http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
ASTERISK-24718 #close
Reported by: Badalian Vyacheslav
Change-Id: Iafa51b792b7bcb20e848b99d16cf362d08590fa0
---
M Makefile.rules
M build_tools/cflags.xml
2 files changed, 48 insertions(+), 0 deletions(-)
Approvals:
Anonymous Coward #1000019: Verified
Matt Jordan: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
diff --git a/Makefile.rules b/Makefile.rules
index a274c95..1031f2d 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -27,6 +27,26 @@
# extra cflags to build dependencies. Recursively expanded.
MAKE_DEPS=-MD -MT $@ -MF .$(subst /,_,$@).d -MP
+ifeq ($(findstring ADDRESS_SANITIZER,$(MENUSELECT_CFLAGS)),ADDRESS_SANITIZER)
+ _ASTLDFLAGS+=-fsanitize=address
+ _ASTCFLAGS+=-fno-omit-frame-pointer -fsanitize=address
+endif
+
+ifeq ($(findstring THREAD_SANITIZER,$(MENUSELECT_CFLAGS)),THREAD_SANITIZER)
+ _ASTLDFLAGS+=-fsanitize=thread -pie -fPIE
+ _ASTCFLAGS+=-fno-omit-frame-pointer -pie -fPIE -fsanitize=thread
+endif
+
+ifeq ($(findstring LEAK_SANITIZER,$(MENUSELECT_CFLAGS)),LEAK_SANITIZER)
+ _ASTLDFLAGS+=-fsanitize=leak
+ _ASTCFLAGS+=-fno-omit-frame-pointer -fsanitize=leak
+endif
+
+ifeq ($(findstring UNDEFINED_SANITIZER,$(MENUSELECT_CFLAGS)),UNDEFINED_SANITIZER)
+ _ASTLDFLAGS+=-fsanitize=undefined
+ _ASTCFLAGS+=-fno-omit-frame-pointer -fsanitize=undefined
+endif
+
ifeq ($(NOISY_BUILD),)
ECHO_PREFIX=@
CMD_PREFIX=@
diff --git a/build_tools/cflags.xml b/build_tools/cflags.xml
index 1a2e78f..d11fb22 100644
--- a/build_tools/cflags.xml
+++ b/build_tools/cflags.xml
@@ -84,6 +84,34 @@
<conflict>MALLOC_DEBUG</conflict>
<support_level>core</support_level>
</member>
+ <member name="ADDRESS_SANITIZER" displayname="Address Sanitizer">
+ <support_level>extended</support_level>
+ <conflict>THREAD_SANITIZER</conflict>
+ <conflict>LEAK_SANITIZER</conflict>
+ <conflict>UNDEFINED_SANITIZER</conflict>
+ <conflict>MALLOC_DEBUG</conflict>
+ <conflict>DEBUG_CHAOS</conflict>
+ </member>
+ <member name="THREAD_SANITIZER" displayname="Thread Sanitizer">
+ <support_level>extended</support_level>
+ <conflict>ADDRESS_SANITIZER</conflict>
+ <conflict>LEAK_SANITIZER</conflict>
+ <conflict>UNDEFINED_SANITIZER</conflict>
+ </member>
+ <member name="LEAK_SANITIZER" displayname="Leak Sanitizer">
+ <support_level>extended</support_level>
+ <conflict>ADDRESS_SANITIZER</conflict>
+ <conflict>THREAD_SANITIZER</conflict>
+ <conflict>UNDEFINED_SANITIZER</conflict>
+ <conflict>MALLOC_DEBUG</conflict>
+ <conflict>DEBUG_CHAOS</conflict>
+ </member>
+ <member name="UNDEFINED_SANITIZER" displayname="Undefined Behavior Sanitizer">
+ <support_level>extended</support_level>
+ <conflict>ADDRESS_SANITIZER</conflict>
+ <conflict>THREAD_SANITIZER</conflict>
+ <conflict>LEAK_SANITIZER</conflict>
+ </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>
--
To view, visit https://gerrit.asterisk.org/1418
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iafa51b792b7bcb20e848b99d16cf362d08590fa0
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Ivan Poddubny <ivan.poddubny at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list