summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2018-08-10 01:32:22 +0200
committerAmar Tumballi <amarts@redhat.com>2018-09-11 04:20:13 +0000
commit0e399b9e4623a68eb681f8c3c5c45e05048a96e8 (patch)
tree0f95d67c044f528894d00c5d109ad1d08be7e678
parentee79077c0d19ddf97caea22cc001b6f4f9b0829c (diff)
rpm: add "--with asan" build option
RHEL-6 does not have libasan, enabling the "--with asan" option is a no-op there. RHEL-7 has an earlier version of libasan, and that does not have the __asan_init symbol. Test for __asan_report_error in confiure.as instead. Change-Id: I6322e832c5cfbd7d750f5c32c84c28771674ced6 Updates: #492 Signed-off-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--configure.ac2
-rw-r--r--glusterfs.spec.in16
2 files changed, 17 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 3fc22254a42..ec4095df7b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,7 +323,7 @@ AC_ARG_ENABLE([asan],
[Enable Address Sanitizer support]))
if test "x$enable_asan" = "xyes"; then
BUILD_ASAN=yes
- AC_CHECK_LIB([asan], [__asan_init], ,
+ AC_CHECK_LIB([asan], [__asan_report_error], ,
[AC_MSG_ERROR([libasan.so not found, this is required for --enable-asan])])
GF_CFLAGS="${GF_CFLAGS} -O1 -g -fsanitize=address -fno-omit-frame-pointer"
dnl -lasan always need to be the first library, otherwise libxml complains
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index e2490f95eca..d4e78a891d0 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -9,6 +9,15 @@
## All argument definitions should be placed here and keep them sorted
##
+# asan
+# if you wish to compile an rpm with address sanitizer...
+# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --with asan
+%{?_with_asan:%global _with_asan --enable-asan}
+
+%if ( 0%{?rhel} && 0%{?rhel} < 7 )
+%global _with_asan %{nil}
+%endif
+
# bd
# if you wish to compile an rpm without the BD map support...
# rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz --without bd
@@ -259,6 +268,9 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%if ( 0%{?_with_systemd:1} )
%{?systemd_requires}
%endif
+%if 0%{?_with_asan:1} && !( 0%{?rhel} && 0%{?rhel} < 7 )
+BuildRequires: libasan
+%endif
BuildRequires: bison flex
BuildRequires: gcc make libtool
BuildRequires: ncurses-devel readline-devel
@@ -724,6 +736,7 @@ export CFLAGS
%endif
%configure \
+ %{?_with_asan} \
%{?_with_cmocka} \
%{?_with_debug} \
%{?_with_firewalld} \
@@ -1501,6 +1514,9 @@ exit 0
%endif
%changelog
+* Fri Sep 7 2018 Niels de Vos <ndevos@redhat.com>
+- Add an option to build with address sanitizer (ASAN)
+
* Sun Jul 29 2018 Niels de Vos <ndevos@redhat.com>
- Disable building glusterfs-resource-agents on el6 (#1609551)