diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-03-08 12:15:35 -0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2018-08-08 11:16:12 -0400 |
commit | 5e666e3d8846e695650ae757d3626547cfd05cbf (patch) | |
tree | 673a2c1972faa19fb78146c7ff2c871c4366e237 /configure | |
parent | 1c2a76aeb0f42e078667cf81412d2dcf6b66b6df (diff) | |
download | e2fsprogs-5e666e3d8846e695650ae757d3626547cfd05cbf.tar.gz |
enable gcc/clang address sanitizer if the builder wants it
Enable AddressSanitizer to look for memory usage errors if the builder
asks for it and it's available.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 52 |
1 files changed, 52 insertions, 0 deletions
@@ -653,6 +653,9 @@ E2SCRUB_CMT UNIX_CMT CYGWIN_CMT LINUX_CMT +addrsan_ldflags +addrsan_cflags +have_addrsan ubsan_ldflags ubsan_cflags have_ubsan @@ -913,6 +916,7 @@ with_libintl_prefix enable_fuse2fs enable_lto enable_ubsan +enable_addrsan with_multiarch with_udev_rules_dir with_crond_dir @@ -1593,6 +1597,7 @@ Optional Features: --disable-fuse2fs do not build fuse2fs --enable-lto enable link time optimization --enable-ubsan enable undefined behavior sanitizer + --enable-addrsan enable address sanitizer Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -13919,6 +13924,53 @@ fi if test "$enable_ubsan" = "yes" && test "$have_ubsan" != "yes"; then as_fn_error $? "UBSAN not supported by compiler." "$LINENO" 5 fi +# Check whether --enable-addrsan was given. +if test "${enable_addrsan+set}" = set; then : + enableval=$enable_addrsan; +else + enable_addrsan=no +fi + +if test "$enable_addrsan" = "yes" || test "$enable_addrsan" = "probe"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if C compiler supports ADDRSAN" >&5 +$as_echo_n "checking if C compiler supports ADDRSAN... " >&6; } + OLD_CFLAGS="$CFLAGS" + OLD_LDFLAGS="$LDFLAGS" + ADDRSAN_FLAGS="-fsanitize=address" + CFLAGS="$CFLAGS $ADDRSAN_FLAGS" + LDFLAGS="$LDFLAGS $ADDRSAN_FLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + addrsan_cflags=$ADDRSAN_FLAGS + addrsan_ldflags=$ADDRSAN_FLAGS + have_addrsan=yes +else + { $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_exeext conftest.$ac_ext + CFLAGS="${OLD_CFLAGS}" + LDFLAGS="${OLD_LDFLAGS}" + + + +fi +if test "$enable_addrsan" = "yes" && test "$have_addrsan" != "yes"; then + as_fn_error $? "ADDRSAN not supported by compiler." "$LINENO" 5 +fi LINUX_CMT="#" CYGWIN_CMT="#" UNIX_CMT= |