[asterisk-commits] Build: Added testing compiler to support the system sanitizes (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 10 14:32:04 CST 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: Build: Added testing compiler to support the system sanitizes
......................................................................


Build: Added testing compiler to support the system sanitizes

In older versions of the compiler was not sanitizes.
Compilers other than GCC can not support the Usan and TSAN
or have other options for *FLAGS.

ASTERISK-25767 #close
Reported by: Badalyan Vyacheslav
Tested by: Badalyan Vyacheslav

Change-Id: Iefce6608221fa87884b82ae3cb5649b7b1804916
---
M build_tools/cflags.xml
M build_tools/menuselect-deps.in
M configure
M configure.ac
4 files changed, 204 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve



diff --git a/build_tools/cflags.xml b/build_tools/cflags.xml
index d11fb22..a43daa0 100644
--- a/build_tools/cflags.xml
+++ b/build_tools/cflags.xml
@@ -85,6 +85,7 @@
 			<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>
@@ -93,12 +94,14 @@
 			<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>
 			<conflict>UNDEFINED_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>
@@ -107,6 +110,7 @@
 			<conflict>DEBUG_CHAOS</conflict>
 		</member>
 		<member name="UNDEFINED_SANITIZER" displayname="Undefined Behavior Sanitizer">
+			<depend>HAVE_UNDEFINED_SANITIZER</depend>
 			<support_level>extended</support_level>
 			<conflict>ADDRESS_SANITIZER</conflict>
 			<conflict>THREAD_SANITIZER</conflict>
diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in
index a77530b..e5413f1 100644
--- a/build_tools/menuselect-deps.in
+++ b/build_tools/menuselect-deps.in
@@ -72,3 +72,7 @@
 ZLIB=@PBX_ZLIB@
 TIMERFD=@PBX_TIMERFD@
 NATIVE_ARCH=@AST_NATIVE_ARCH@
+HAVE_ADDRESS_SANITIZER=@AST_ADDRESS_SANITIZER@
+HAVE_LEAK_SANITIZER=@AST_LEAK_SANITIZER@
+HAVE_THREAD_SANITIZER=@AST_THREAD_SANITIZER@
+HAVE_UNDEFINED_SANITIZER=@AST_UNDEFINED_SANITIZER@
diff --git a/configure b/configure
index 1ae3a04..2974396 100755
--- a/configure
+++ b/configure
@@ -697,6 +697,10 @@
 AST_DECLARATION_AFTER_STATEMENT
 GC_LDFLAGS
 GC_CFLAGS
+AST_UNDEFINED_SANITIZER
+AST_LEAK_SANITIZER
+AST_THREAD_SANITIZER
+AST_ADDRESS_SANITIZER
 PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 PBX_PTHREAD_RWLOCK_INITIALIZER
 AST_ASTERISKSSL
@@ -17437,6 +17441,134 @@
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=address support" >&5
+$as_echo_n "checking for -fsanitize=address support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
+LDFLAGS="-fsanitize=address"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int x = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	AST_ADDRESS_SANITIZER=1
+else
+  AST_ADDRESS_SANITIZER=
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=thread support" >&5
+$as_echo_n "checking for -fsanitize=thread support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -pie -fPIE -fsanitize=thread"
+LDFLAGS="-fsanitize=thread -pie -fPIE"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int x = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	AST_THREAD_SANITIZER=1
+else
+  AST_THREAD_SANITIZER=
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=leak support" >&5
+$as_echo_n "checking for -fsanitize=leak support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -fsanitize=leak"
+LDFLAGS="-fsanitize=leak"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int x = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	AST_LEAK_SANITIZER=1
+else
+  AST_LEAK_SANITIZER=
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fsanitize=undefined support" >&5
+$as_echo_n "checking for -fsanitize=undefined support... " >&6; }
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -fsanitize=undefined"
+LDFLAGS="-fsanitize=undefined"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+int x = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	AST_UNDEFINED_SANITIZER=1
+else
+  AST_UNDEFINED_SANITIZER=
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ffunction-sections support" >&5
 $as_echo_n "checking for -ffunction-sections support... " >&6; }
 saved_CFLAGS="${CFLAGS}"
diff --git a/configure.ac b/configure.ac
index 6321367..c85d6f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1049,6 +1049,70 @@
 AST_GCC_ATTRIBUTE(constructor)
 AST_GCC_ATTRIBUTE(destructor)
 
+AC_MSG_CHECKING(for -fsanitize=address support)
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
+LDFLAGS="-fsanitize=address"
+AC_COMPILE_IFELSE(
+	[AC_LANG_PROGRAM([], [int x = 1;])],
+	AC_MSG_RESULT(yes)
+	[AST_ADDRESS_SANITIZER=1],
+	[AST_ADDRESS_SANITIZER=]
+	AC_MSG_RESULT(no)
+)
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+AC_SUBST(AST_ADDRESS_SANITIZER)
+
+AC_MSG_CHECKING(for -fsanitize=thread support)
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -pie -fPIE -fsanitize=thread"
+LDFLAGS="-fsanitize=thread -pie -fPIE"
+AC_COMPILE_IFELSE(
+	[AC_LANG_PROGRAM([], [int x = 1;])],
+	AC_MSG_RESULT(yes)
+	[AST_THREAD_SANITIZER=1],
+	[AST_THREAD_SANITIZER=]
+	AC_MSG_RESULT(no)
+)
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+AC_SUBST(AST_THREAD_SANITIZER)
+
+AC_MSG_CHECKING(for -fsanitize=leak support)
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -fsanitize=leak"
+LDFLAGS="-fsanitize=leak"
+AC_COMPILE_IFELSE(
+	[AC_LANG_PROGRAM([], [int x = 1;])],
+	AC_MSG_RESULT(yes)
+	[AST_LEAK_SANITIZER=1],
+	[AST_LEAK_SANITIZER=]
+	AC_MSG_RESULT(no)
+)
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+AC_SUBST(AST_LEAK_SANITIZER)
+
+AC_MSG_CHECKING(for -fsanitize=undefined support)
+saved_sanitize_CFLAGS="${CFLAGS}"
+saved_sanitize_LDFLAGS="${LDFLAGS}"
+CFLAGS="-fno-omit-frame-pointer -fsanitize=undefined"
+LDFLAGS="-fsanitize=undefined"
+AC_COMPILE_IFELSE(
+	[AC_LANG_PROGRAM([], [int x = 1;])],
+	AC_MSG_RESULT(yes)
+	[AST_UNDEFINED_SANITIZER=1],
+	[AST_UNDEFINED_SANITIZER=]
+	AC_MSG_RESULT(no)
+)
+CFLAGS="${saved_sanitize_CFLAGS}"
+LDFLAGS="${saved_sanitize_LDFLAGS}"
+AC_SUBST(AST_UNDEFINED_SANITIZER)
+
 AC_MSG_CHECKING(for -ffunction-sections support)
 saved_CFLAGS="${CFLAGS}"
 CFLAGS="${CFLAGS} -ffunction-sections"

-- 
To view, visit https://gerrit.asterisk.org/2233
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefce6608221fa87884b82ae3cb5649b7b1804916
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Badalian Vyacheslav <v.badalyan at open-bs.ru>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list