diff options
author | Zack Weinberg <zackw@panix.com> | 2021-07-20 11:58:32 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2021-07-22 08:11:12 -0400 |
commit | 3aa82ccd3a3fecea7e6a9d0f9c85c56e2e04bb78 (patch) | |
tree | 666c0b59a7b15cbf00a25bde94628af5966dba09 /build-aux | |
parent | 41886a8f1f07a5bfeb1eb4e9c05d0525d16d2b15 (diff) | |
download | libxcrypt-3aa82ccd3a3fecea7e6a9d0f9c85c56e2e04bb78.tar.gz libxcrypt-3aa82ccd3a3fecea7e6a9d0f9c85c56e2e04bb78.tar.bz2 libxcrypt-3aa82ccd3a3fecea7e6a9d0f9c85c56e2e04bb78.zip |
Detect ASan in configure and disable incompatible tests.
ASan’s “interceptors” for crypt and crypt_r have a semantic conflict
with libxcrypt, requiring a few tests to be disabled for builds with
-fsanitize-address. See commentary in test/crypt-badargs.c for an
explanation of the conflict, and commentary in build-aux/zw_detect_asan.m4
for why a configure test is required.
This does not work around https://github.com/google/sanitizers/issues/1365
which is an unrelated problem affecting test/special-char-salt.c and
which doesn’t currently break CI.
Diffstat (limited to 'build-aux')
-rw-r--r-- | build-aux/zw_detect_asan.m4 | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/build-aux/zw_detect_asan.m4 b/build-aux/zw_detect_asan.m4 new file mode 100644 index 0000000..907d35f --- /dev/null +++ b/build-aux/zw_detect_asan.m4 @@ -0,0 +1,24 @@ +dnl Written by Zack Weinberg <zackw at panix.com> in 2021. +dnl To the extent possible under law, Zack Weinberg has waived all +dnl copyright and related or neighboring rights to this work. +dnl +dnl See https://creativecommons.org/publicdomain/zero/1.0/ for further +dnl details. +dnl +dnl Detect whether the active compiler compiles programs with ASan +dnl instrumentation. If so, execute ACTIONS-IF-TRUE, otherwise +dnl ACTIONS-IF-FALSE. +dnl +dnl Implementation note: with clang one can use __has_feature(address_sanitizer) +dnl to detect ASan, but gcc does not support that. Instead we look +dnl for ASan symbols in the linked executable. This requires a helper +dnl macro shipped with libtool. +dnl +dnl zw_ASAN_IFELSE(actions-if-true[, actions-if-false]) +AC_DEFUN([zw_ASAN_IFELSE], + [AC_REQUIRE([AC_PROG_EGREP])]dnl + [AC_REQUIRE([LT_PATH_NM])]dnl + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [AS_IF([$NM conftest$EXEEXT | $EGREP _asan_ > /dev/null 2>&1], + [$1], [$2])], + [AC_MSG_ERROR([cannot link a trivial test program])])]) |