Skip to content

Commit 151b9f0

Browse files
authored
Merge pull request wolfSSL#8633 from JacobBarthelmeh/compile
do sanity check for -Wa,-mbranches-within-32B-boundaries use
2 parents 5ecacfd + f6894a3 commit 151b9f0

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

configure.ac

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,6 @@ DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL"
178178
LIB_ADD=
179179
LIB_STATIC_ADD=
180180

181-
EXTRA_OPTS_CFLAGS=
182-
if test "$host_cpu" = "x86_64"
183-
then
184-
if test "$CC" = "gcc" || test "$CC" = "icc"
185-
then
186-
EXTRA_OPTS_CFLAGS="$EXTRA_OPTS_CFLAGS -Wa,-mbranches-within-32B-boundaries -falign-loops=64"
187-
fi
188-
fi
189181
OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS $EXTRA_OPTS_CFLAGS"
190182
OPTIMIZE_FAST_CFLAGS="$OPTIMIZE_FAST_CFLAGS $EXTRA_OPTS_CFLAGS"
191183
OPTIMIZE_HUGE_CFLAGS="$OPTIMIZE_HUGE_CFLAGS $EXTRA_OPTS_CFLAGS"
@@ -2526,6 +2518,30 @@ then
25262518
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_CHECK_SIG_FAULTS -DWOLFSSL_CHECK_VER_FAULTS"
25272519
fi
25282520

2521+
AC_ARG_ENABLE([compileharden],
2522+
[AS_HELP_STRING([--enable-compileharden],[Enable extra hardening compile flags (default: disabled)])],
2523+
[ENABLED_COMPILEHARDEN=$enableval],
2524+
[ENABLED_COMPILEHARDEN=no])
2525+
2526+
EXTRA_OPTS_CFLAGS=
2527+
if test "$ENABLED_COMPILEHARDEN" = "yes"
2528+
then
2529+
CAN_USE_32B_BOUNDARIES_FLAG=no
2530+
AX_CHECK_COMPILE_FLAG([-Wa,-mbranches-within-32B-boundaries],
2531+
[CAN_USE_32B_BOUNDARIES_FLAG=yes],
2532+
[CAN_USE_32B_BOUNDARIES_FLAG=no],
2533+
[-Werror],[])
2534+
2535+
if test "$CAN_USE_32B_BOUNDARIES_FLAG" = "yes"
2536+
then
2537+
EXTRA_OPTS_CFLAGS="$EXTRA_OPTS_CFLAGS -Wa,-mbranches-within-32B-boundaries -falign-loops=64"
2538+
else
2539+
AC_MSG_ERROR([compiler does not accept -mbranches-within-32B-boundaries flag])
2540+
fi
2541+
fi
2542+
2543+
2544+
25292545
# IPv6 Test Apps
25302546
AC_ARG_ENABLE([ipv6],
25312547
[AS_HELP_STRING([--enable-ipv6],[Enable testing of IPV6 (default: disabled)])],

0 commit comments

Comments
 (0)