From: Quentin Young Date: Thu, 22 Mar 2018 00:47:34 +0000 (-0400) Subject: frr: --enable-address-sanitizer X-Git-Tag: frr-5.0-dev~116^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=fac8a744c6033a9c03a3edd40e4fc4a0f72e6e1f;p=matthieu%2Ffrr.git frr: --enable-address-sanitizer Modify Autotools files to support an easy option for enabling ASAN. Signed-off-by: Quentin Young --- diff --git a/common.am b/common.am index c0094b1b88..a52e831199 100644 --- a/common.am +++ b/common.am @@ -8,12 +8,13 @@ am__v_CLIPPY_ = $(am__v_CLIPPY_$(AM_DEFAULT_VERBOSITY)) am__v_CLIPPY_0 = @echo " CLIPPY " $@; am__v_CLIPPY_1 = +CLIPPY_SUPPRESSIONS = LSAN_OPTIONS="suppressions=$(top_builddir)/tools/lsan-suppressions.txt" CLIPPY_DEPS = $(HOSTTOOLS)lib/clippy $(top_srcdir)/python/clidef.py SUFFIXES = _clippy.c .proto .pb-c.c .pb-c.h .pb.h .c_clippy.c: @{ test -x $(top_builddir)/$(HOSTTOOLS)lib/clippy || $(MAKE) -C $(top_builddir)/$(HOSTTOOLS) lib/clippy; } - $(AM_V_CLIPPY)$(top_builddir)/$(HOSTTOOLS)lib/clippy $(top_srcdir)/python/clidef.py -o $@ $< + $(AM_V_CLIPPY) $(CLIPPY_SUPPRESSIONS) $(top_builddir)/$(HOSTTOOLS)lib/clippy $(top_srcdir)/python/clidef.py -o $@ $< ## automake's "ylwrap" is a great piece of GNU software... not. .l.c: diff --git a/configure.ac b/configure.ac index 24d6fa0867..b2a997afdd 100755 --- a/configure.ac +++ b/configure.ac @@ -185,6 +185,17 @@ CC="${CC% -std=c99}" AC_C_FLAG([-std=gnu11], [CC="$ac_cc"], [CC="$CC -std=gnu11"]) +dnl AddressSanitizer support +AC_ARG_ENABLE([address-sanitizer], AS_HELP_STRING([--enable-address-sanitizer], \ + [enabled AddressSanitizer support for detecting a wide variety of \ + memory allocation and deallocation errors]), \ + [AC_DEFINE(HAVE_ADDRESS_SANITIZER, 1, [enable AddressSanitizer]) + CFLAGS="$CFLAGS -fsanitize=address" + CXXFLAGS="$CXXFLAGS -fsanitize=address" + AC_TRY_COMPILE([],[const int i=0;],[AC_MSG_NOTICE([Address Sanitizer Enabled])], + [AC_MSG_ERROR([Address Sanitizer not available])]) + ]) + dnl if the user has specified any CFLAGS, override our settings if test "x${enable_dev_build}" = "xyes"; then AC_DEFINE(DEV_BUILD,,Build for development)