configure.ac |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit 90188d07c17048291b6a64d461a982129a3f8837
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sat Sep 21 16:29:56 2019 -0400
Commit:     Ashod Nakashian <ashnak...@gmail.com>
CommitDate: Sun Sep 22 20:26:25 2019 +0200

    configure: support sanitizers
    
    It is now possible to run ./configure --with-sanitizer=address
    (or any least of valid sanitizers) to build with sanitizers.
    
    When --with-sanitizer is specified, we build with -O1 and
    don't omit frame-pointer. We also enable RTTI (which should
    be enabled anyway, but just in case).
    
    UBSan (undefined) sanitizer can cause 'typeinfo' errors.
    Fixing the source is best, but as a workaround, disabling
    vptr sanitizer works. Just pass -fno-sanitize=vptr to CFLAGS
    and CXXFLAGS.
    
    Change-Id: I4031aa872b1b1ef779703135394f3733952e5cd1
    Reviewed-on: https://gerrit.libreoffice.org/79329
    Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
    Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/configure.ac b/configure.ac
index 711de7d01..c3ab7c195 100644
--- a/configure.ac
+++ b/configure.ac
@@ -184,6 +184,10 @@ AC_ARG_WITH([max-documents],
              AS_HELP_STRING([--with-max-documents],
                            [Set the limit on the total number of documents. 
Def: 10, Min: 2.]))
 
+AC_ARG_WITH([sanitizer],
+             AS_HELP_STRING([--with-sanitizer],
+                           [Enable one or more compatible sanitizers. E.g. 
--with-sanitizer=address,undefined,leak]))
+
 AC_ARG_WITH([compiler-plugins],
             AS_HELP_STRING([--with-compiler-plugins=<path>],
                 [Experimental! Unlikely to work for anyone except Noel! Enable 
compiler plugins that will perform additional checks during
@@ -460,6 +464,16 @@ else
     AC_MSG_RESULT([no])
 fi
 
+AC_MSG_CHECKING([whether to turn sanitizers on])
+if test "x$with_sanitizer" != "x"; then
+    AC_MSG_RESULT([yes ($with_sanitizer)])
+    SANITIZER_FLAGS="-O1 -fno-omit-frame-pointer -fsanitize=$with_sanitizer 
-frtti -static-libasan"
+    CXXFLAGS="$CXXFLAGS $SANITIZER_FLAGS"
+    CFLAGS="$CFLAGS $SANITIZER_FLAGS"
+else
+    AC_MSG_RESULT([no])
+fi
+
 # check for C++11 support
 HAVE_CXX11=
 AC_MSG_CHECKING([whether $CXX supports C++14 or C++11])
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to