diff options
author | Darren Tucker <dtucker@dtucker.net> | 2022-11-30 11:23:11 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2022-12-16 14:23:02 +1100 |
commit | 004dafb2281bc6cad864a5b4452bbae44edc7816 (patch) | |
tree | c3c4b742615b0df05d5ba568aa0b61f82b4f0538 | |
parent | 92351b2203d568a852bd8559b380d4595e00ea2d (diff) |
Use -fzero-call-used-regs=used on clang 15.
clang 15 seems to have a problem with -fzero-call-used-reg=all which
causes spurious "incorrect signature" failures with ED25519. On those
versions, use -fzero-call-used-regs=used instead. (We may add exceptions
later if specific versions prove to be OK). Also move the GCC version
check to match.
Initial investigation by Daniel Pouzzner (douzzer at mega nu), workaround
suggested by Bill Wendling (morbo at google com). bz#3475, ok djm@
-rw-r--r-- | configure.ac | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index c591a041..5eb55eb0 100644 --- a/configure.ac +++ b/configure.ac @@ -172,6 +172,22 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])], CFLAGS="$saved_CFLAGS" if test "$GCC" = "yes" || test "$GCC" = "egcs"; then + AC_MSG_CHECKING([gcc version]) + GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` + case "$GCC_VER" in + 1.*) no_attrib_nonnull=1 ;; + 2.8* | 2.9*) + no_attrib_nonnull=1 + ;; + 2.*) no_attrib_nonnull=1 ;; + *) ;; + esac + AC_MSG_RESULT([$GCC_VER]) + + AC_MSG_CHECKING([clang version]) + CLANG_VER=`$CC -v 2>&1 | $AWK '/clang version /{print $3}'` + AC_MSG_RESULT([$CLANG_VER]) + OSSH_CHECK_CFLAG_COMPILE([-pipe]) OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option]) OSSH_CHECK_CFLAG_COMPILE([-Wno-error=format-truncation]) @@ -203,20 +219,15 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then # actually links. The test program compiled/linked includes a number # of integer operations that should exercise this. OSSH_CHECK_CFLAG_LINK([-ftrapv]) - OSSH_CHECK_CFLAG_COMPILE([-fzero-call-used-regs=all]) + # clang 15 seems to have a big in -fzero-call-used-regs=all. See + # https://bugzilla.mindrot.org/show_bug.cgi?id=3475 and + # https://github.com/llvm/llvm-project/issues/59242 + case "$CLANG_VER" in + 15.*) OSSH_CHECK_CFLAG_COMPILE([-fzero-call-used-regs=used]) ;; + *) OSSH_CHECK_CFLAG_COMPILE([-fzero-call-used-regs=all]) ;; + esac OSSH_CHECK_CFLAG_COMPILE([-ftrivial-auto-var-init=zero]) fi - AC_MSG_CHECKING([gcc version]) - GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` - case $GCC_VER in - 1.*) no_attrib_nonnull=1 ;; - 2.8* | 2.9*) - no_attrib_nonnull=1 - ;; - 2.*) no_attrib_nonnull=1 ;; - *) ;; - esac - AC_MSG_RESULT([$GCC_VER]) AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset]) saved_CFLAGS="$CFLAGS" |