summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-03 16:37:29 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-03 16:37:29 +0300
commit18c113350a4ac9c712f81b1143269ee7f678ea6c (patch)
tree958ca4efdad2f3fad567827ebac1545f18209d90
parentf5ed898d4dc394af26fc1f0545861794331bd985 (diff)
parent5f308d20edf1b6769895aac265314187305ebe1f (diff)
downloadhercules-18c113350a4ac9c712f81b1143269ee7f678ea6c.tar.gz
hercules-18c113350a4ac9c712f81b1143269ee7f678ea6c.tar.bz2
hercules-18c113350a4ac9c712f81b1143269ee7f678ea6c.tar.xz
hercules-18c113350a4ac9c712f81b1143269ee7f678ea6c.zip
Merge pull request #2 from MishimaHaruna/fsanitize
Split -fsanitize checks into multiple steps
-rwxr-xr-xconfigure783
-rw-r--r--configure.in90
2 files changed, 803 insertions, 70 deletions
diff --git a/configure b/configure
index 1db181e46..3e0c4746c 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in 5c1d773.
+# From configure.in f5ed898.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -1357,7 +1357,8 @@ Optional Features:
is enabled by default)
--enable-static Enables or Disables Statick Linking (STATIC is
disabled by default)
- --enable-sanitize[=ARG] Sanitize: yes, no, full)
+ --enable-sanitize[=ARG] Enables sanitizer. (disabled by default) (available
+ options: yes, no, full)
--disable-renewal Disable Ragnarok Renewal support (override settings
in src/config/renewal.h)
@@ -5055,63 +5056,779 @@ fi
fi
+
#
# sanitize Support test
#
if test "$enable_sanitize" != "no" ; then
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=address" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=address... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=address"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=address" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=address... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
if test "$enable_sanitize" == "full" ; then
- # skipped because server have multiply issues -fsanitize=alignment
- SAN="-fsanitize=address \
--fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable \
--fsanitize=vla-bound -fsanitize=null -fsanitize=return \
--fsanitize=signed-integer-overflow -fsanitize=bounds \
--fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow \
--fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool \
--fsanitize=enum -fsanitize=vptr"
- else
- SAN="-fsanitize=address"
- fi
+ # skipped because server have multiple issues -fsanitize=alignment
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $SAN"
- OLD_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $SAN"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=shift" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=shift... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=shift"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $SAN" >&5
-$as_echo_n "checking whether $CC supports $SAN... " >&6; }
- if test "$cross_compiling" = yes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: guessing no" >&5
-$as_echo "guessing no" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=shift" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=shift... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=integer-divide-by-zero" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=integer-divide-by-zero... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=integer-divide-by-zero"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
- int main(int argc, char **argv){
- return 0;
- }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=integer-divide-by-zero" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=integer-divide-by-zero... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
+if ac_fn_c_try_compile "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- CFLAGS="$OLD_CFLAGS"
- LDFLAGS="$OLD_LDFLAGS"
+ CFLAGS="$OLD_CFLAGS"
+
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=unreachable" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=unreachable... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=unreachable"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=unreachable" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=unreachable... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=vla-bound" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=vla-bound... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=vla-bound"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=vla-bound" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=vla-bound... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=null" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=null... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=null" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=null... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=return" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=return... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=return"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=return" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=return... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=signed-integer-overflow" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=signed-integer-overflow... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=signed-integer-overflow"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=signed-integer-overflow" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=signed-integer-overflow... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=bounds" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=bounds... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=bounds"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=bounds" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=bounds... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=object-size" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=object-size... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=object-size"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=object-size" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=object-size... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=float-divide-by-zero" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=float-divide-by-zero... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=float-divide-by-zero"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=float-divide-by-zero" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=float-divide-by-zero... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=float-cast-overflow" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=float-cast-overflow... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=float-cast-overflow"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=float-cast-overflow" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=float-cast-overflow... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=nonnull-attribute" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=nonnull-attribute... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=nonnull-attribute"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=nonnull-attribute" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=nonnull-attribute... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=returns-nonnull-attribute" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=returns-nonnull-attribute... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=returns-nonnull-attribute"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=returns-nonnull-attribute" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=returns-nonnull-attribute... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=bool" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=bool... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=bool"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=bool" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=bool... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=enum" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=enum... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=enum"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=enum" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=enum... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=vptr" >&5
+$as_echo_n "checking whether $CC supports -fsanitize=vptr... " >&6; }
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=vptr"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=vptr" >&5
+$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=vptr... " >&6; }
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ CFLAGS="$OLD_CFLAGS"
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
+ fi
fi
diff --git a/configure.in b/configure.in
index 3b5420c8b..f8a3fa639 100644
--- a/configure.in
+++ b/configure.in
@@ -302,7 +302,8 @@ AC_ARG_ENABLE(
AC_HELP_STRING(
[--enable-sanitize@<:@=ARG@:>@],
[
- Sanitize: yes, no, full)
+ Enables sanitizer. (disabled by default)
+ (available options: yes, no, full)
]
),
[
@@ -621,49 +622,64 @@ if test "$enable_lto" != "no" ; then
)
fi
+AC_DEFUN(AC_CHECK_SANITIZER_FLAG,
+ [
+ AC_MSG_CHECKING([whether $CC supports -fsanitize=$1])
+ OLD_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -fsanitize=$1"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([int foo;])],
+ [
+ AC_MSG_RESULT([yes])
+ ],
+ [
+ AC_MSG_RESULT([no])
+
+ AC_MSG_CHECKING([whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=$1])
+ CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error"
+ AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([int foo;])],
+ [
+ AC_MSG_RESULT([yes])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ )
+ ],
+ [
+ AC_MSG_RESULT([guessing no])
+ CFLAGS="$OLD_CFLAGS"
+ ]
+ )
+ ]
+)
#
# sanitize Support test
#
if test "$enable_sanitize" != "no" ; then
+ AC_CHECK_SANITIZER_FLAG(address)
if test "$enable_sanitize" == "full" ; then
- # skipped because server have multiply issues -fsanitize=alignment
- SAN="-fsanitize=address \
--fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable \
--fsanitize=vla-bound -fsanitize=null -fsanitize=return \
--fsanitize=signed-integer-overflow -fsanitize=bounds \
--fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow \
--fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool \
--fsanitize=enum -fsanitize=vptr"
- else
- SAN="-fsanitize=address"
+ # skipped because server have multiple issues: -fsanitize=alignment
+ AC_CHECK_SANITIZER_FLAG(shift)
+ AC_CHECK_SANITIZER_FLAG(integer-divide-by-zero)
+ AC_CHECK_SANITIZER_FLAG(unreachable)
+ AC_CHECK_SANITIZER_FLAG(vla-bound)
+ AC_CHECK_SANITIZER_FLAG(null)
+ AC_CHECK_SANITIZER_FLAG(return)
+ AC_CHECK_SANITIZER_FLAG(signed-integer-overflow)
+ AC_CHECK_SANITIZER_FLAG(bounds)
+ AC_CHECK_SANITIZER_FLAG(object-size)
+ AC_CHECK_SANITIZER_FLAG(float-divide-by-zero)
+ AC_CHECK_SANITIZER_FLAG(float-cast-overflow)
+ AC_CHECK_SANITIZER_FLAG(nonnull-attribute)
+ AC_CHECK_SANITIZER_FLAG(returns-nonnull-attribute)
+ AC_CHECK_SANITIZER_FLAG(bool)
+ AC_CHECK_SANITIZER_FLAG(enum, sanitize-undefined-trap-on-error)
+ AC_CHECK_SANITIZER_FLAG(vptr)
fi
-
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $SAN"
- OLD_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $SAN"
-
- AC_MSG_CHECKING([whether $CC supports $SAN])
- AC_RUN_IFELSE(
- [AC_LANG_SOURCE([
- int main(int argc, char **argv){
- return 0;
- }
- ])],
- [
- AC_MSG_RESULT([yes])
- ],
- [
- AC_MSG_RESULT([no])
- CFLAGS="$OLD_CFLAGS"
- LDFLAGS="$OLD_LDFLAGS"
- ],
- [
- AC_MSG_RESULT([guessing no])
- ]
- )
-
fi