java-latest-openjdk/jdk8259949-allow_cf-protection_on_x86.patch
Jiri 94a25f51fa Porting changes from master
Replaced alt-java palceholder by real pathced alt-java
Fixes comment for speculative store bypass patch
Redeffined linux -> __linux__ and __x86_64 -> __x86_64__; should be backported to jdk11 and jdk8
moved wrongly placed icenses to acompany other ones
Fixed not-including fastdebugbuild in case of --without fastdebug
Added checks and restrictions around alt-java
many cosmetic changes taken from more maintained jdk11
Added few missing majorver into descriptions
removed lib-style provides for fastdebug_suffix_unquoted
fixed missing condition for fastdebug packages being counted as debug ones
Fixed typo in variable
Add BuildRequires: make
Use -march=i686 for x86 builds if -fcf-protection is detected (needs CMOV)
2021-01-25 16:37:05 +01:00

28 lines
1.1 KiB
Diff

diff --git openjdk.orig/make/autoconf/flags-cflags.m4 openjdk/make/autoconf/flags-cflags.m4
--- openjdk.orig/make/autoconf/flags-cflags.m4
+++ openjdk/make/autoconf/flags-cflags.m4
@@ -715,9 +715,21 @@
# 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