From e84e941746e1baec13b4bcde981caebccb64e3f6 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Fri, 30 Mar 2018 08:34:49 -0400 Subject: spectre clang support --- configure | 22 +++++++++++++++++++--- configure.ac | 8 ++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 0ccaad051..9a7d91111 100755 --- a/configure +++ b/configure @@ -3106,20 +3106,36 @@ fi HAVE_SPECTRE="no" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Spectre mitigation support in gcc compiler" >&5 -$as_echo_n "checking for Spectre mitigation support in gcc compiler... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Spectre mitigation support in gcc or clang compiler" >&5 +$as_echo_n "checking for Spectre mitigation support in gcc or clang compiler... " >&6; } if test "$CC" = "gcc"; then : HAVE_SPECTRE="yes" $CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no" rm -f dummy.o + if test "$HAVE_SPECTRE" = "yes"; then : + + EXTRA_CFLAGS+=" -mindirect-branch=thunk " + +fi + +fi +if test "$CC" = "clang"; then : + + HAVE_SPECTRE="yes" + $CC -mretpoline -c dummy.c || HAVE_SPECTRE="no" + rm -f dummy.o + if test "$HAVE_SPECTRE" = "yes"; then : + + EXTRA_CFLAGS+=" -mretpoline " + +fi fi if test "$HAVE_SPECTRE" = "yes"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - EXTRA_CFLAGS+=" -mindirect-branch=thunk " fi if test "$HAVE_SPECTRE" = "no"; then : diff --git a/configure.ac b/configure.ac index 1f573d50f..d3405a135 100644 --- a/configure.ac +++ b/configure.ac @@ -14,13 +14,17 @@ AS_IF([test "$CC" = "gcc"], [ HAVE_SPECTRE="yes" $CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no" rm -f dummy.o - EXTRA_CFLAGS+=" -mindirect-branch=thunk " + AS_IF([test "$HAVE_SPECTRE" = "yes"], [ + EXTRA_CFLAGS+=" -mindirect-branch=thunk " + ]) ]) AS_IF([test "$CC" = "clang"], [ HAVE_SPECTRE="yes" $CC -mretpoline -c dummy.c || HAVE_SPECTRE="no" rm -f dummy.o - EXTRA_CFLAGS+=" -mretpoline " + AS_IF([test "$HAVE_SPECTRE" = "yes"], [ + EXTRA_CFLAGS+=" -mretpoline " + ]) ]) AS_IF([test "$HAVE_SPECTRE" = "yes"], [ AC_MSG_RESULT(yes) -- cgit v1.2.3-54-g00ecf