Skip to content
Permalink
Browse files
8259949: x86 32-bit build fails when -fcf-protection is passed in the…
… compiler flags

Use -march=i686 instead of -march=i586 if -fcf-protection is passed to the build as CMOV is required

Backport-of: 0785147
  • Loading branch information
gnu-andrew committed Mar 4, 2021
1 parent fd2aac7 commit b8d5fcbe433d7f2677ae38978bd3095318a67a49
Showing 1 changed file with 14 additions and 2 deletions.
@@ -782,9 +782,21 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
# CFLAGS PER CPU
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# COMMON to gcc and clang
AC_MSG_CHECKING([if $1 is x86])
if test "x$FLAGS_CPU" = xx86; then
# Force compatibility with i586 on 32 bit intel platforms.
$1_CFLAGS_CPU="-march=i586"
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if control flow protection is enabled by additional compiler flags])
if echo "${EXTRA_CFLAGS}${EXTRA_CXXFLAGS}${EXTRA_ASFLAGS}" | ${GREP} -q 'fcf-protection' ; then
# cf-protection requires CMOV and thus i686
$1_CFLAGS_CPU="-march=i686"
AC_MSG_RESULT([yes, forcing ${$1_CFLAGS_CPU}])
else
# Force compatibility with i586 on 32 bit intel platforms.
$1_CFLAGS_CPU="-march=i586"
AC_MSG_RESULT([no, forcing ${$1_CFLAGS_CPU}])
fi
else
AC_MSG_RESULT([no])
fi
fi

1 comment on commit b8d5fcb

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on b8d5fcb Mar 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.