diff options
-rwxr-xr-x | configure | 22 | ||||
-rw-r--r-- | configure.ac | 8 |
2 files changed, 25 insertions, 5 deletions
@@ -3106,20 +3106,36 @@ fi | |||
3106 | 3106 | ||
3107 | 3107 | ||
3108 | HAVE_SPECTRE="no" | 3108 | HAVE_SPECTRE="no" |
3109 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Spectre mitigation support in gcc compiler" >&5 | 3109 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Spectre mitigation support in gcc or clang compiler" >&5 |
3110 | $as_echo_n "checking for Spectre mitigation support in gcc compiler... " >&6; } | 3110 | $as_echo_n "checking for Spectre mitigation support in gcc or clang compiler... " >&6; } |
3111 | if test "$CC" = "gcc"; then : | 3111 | if test "$CC" = "gcc"; then : |
3112 | 3112 | ||
3113 | HAVE_SPECTRE="yes" | 3113 | HAVE_SPECTRE="yes" |
3114 | $CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no" | 3114 | $CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no" |
3115 | rm -f dummy.o | 3115 | rm -f dummy.o |
3116 | if test "$HAVE_SPECTRE" = "yes"; then : | ||
3117 | |||
3118 | EXTRA_CFLAGS+=" -mindirect-branch=thunk " | ||
3119 | |||
3120 | fi | ||
3121 | |||
3122 | fi | ||
3123 | if test "$CC" = "clang"; then : | ||
3124 | |||
3125 | HAVE_SPECTRE="yes" | ||
3126 | $CC -mretpoline -c dummy.c || HAVE_SPECTRE="no" | ||
3127 | rm -f dummy.o | ||
3128 | if test "$HAVE_SPECTRE" = "yes"; then : | ||
3129 | |||
3130 | EXTRA_CFLAGS+=" -mretpoline " | ||
3131 | |||
3132 | fi | ||
3116 | 3133 | ||
3117 | fi | 3134 | fi |
3118 | if test "$HAVE_SPECTRE" = "yes"; then : | 3135 | if test "$HAVE_SPECTRE" = "yes"; then : |
3119 | 3136 | ||
3120 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 | 3137 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
3121 | $as_echo "yes" >&6; } | 3138 | $as_echo "yes" >&6; } |
3122 | EXTRA_CFLAGS+=" -mindirect-branch=thunk " | ||
3123 | 3139 | ||
3124 | fi | 3140 | fi |
3125 | if test "$HAVE_SPECTRE" = "no"; then : | 3141 | 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"], [ | |||
14 | HAVE_SPECTRE="yes" | 14 | HAVE_SPECTRE="yes" |
15 | $CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no" | 15 | $CC -mindirect-branch=thunk -c dummy.c || HAVE_SPECTRE="no" |
16 | rm -f dummy.o | 16 | rm -f dummy.o |
17 | EXTRA_CFLAGS+=" -mindirect-branch=thunk " | 17 | AS_IF([test "$HAVE_SPECTRE" = "yes"], [ |
18 | EXTRA_CFLAGS+=" -mindirect-branch=thunk " | ||
19 | ]) | ||
18 | ]) | 20 | ]) |
19 | AS_IF([test "$CC" = "clang"], [ | 21 | AS_IF([test "$CC" = "clang"], [ |
20 | HAVE_SPECTRE="yes" | 22 | HAVE_SPECTRE="yes" |
21 | $CC -mretpoline -c dummy.c || HAVE_SPECTRE="no" | 23 | $CC -mretpoline -c dummy.c || HAVE_SPECTRE="no" |
22 | rm -f dummy.o | 24 | rm -f dummy.o |
23 | EXTRA_CFLAGS+=" -mretpoline " | 25 | AS_IF([test "$HAVE_SPECTRE" = "yes"], [ |
26 | EXTRA_CFLAGS+=" -mretpoline " | ||
27 | ]) | ||
24 | ]) | 28 | ]) |
25 | AS_IF([test "$HAVE_SPECTRE" = "yes"], [ | 29 | AS_IF([test "$HAVE_SPECTRE" = "yes"], [ |
26 | AC_MSG_RESULT(yes) | 30 | AC_MSG_RESULT(yes) |