8292226: Prepare make for better Link Time Optimization support

Reviewed-by: ihse
This commit is contained in:
Julian Waters 2022-08-22 11:00:17 +00:00 committed by Magnus Ihse Bursie
parent 79597f1ea6
commit 1ed03d82b2
2 changed files with 10 additions and 6 deletions

View File

@ -367,6 +367,9 @@ isBuildCpu = \
isBuildCpuArch = \
$(strip $(if $(filter $(OPENJDK_BUILD_CPU_ARCH), $1), true, false))
isCompiler = \
$(strip $(if $(filter $(TOOLCHAIN_TYPE), $1), true, false))
################################################################################
# Converts a space separated list to a comma separated list.
#

View File

@ -169,12 +169,13 @@ endif
################################################################################
ifeq ($(call check-jvm-feature, link-time-opt), true)
# NOTE: Disable automatic opimization level and let the explicit cflag control
# optimization level instead. This activates O3 on slowdebug builds, just
# like the old build, but it's probably not right.
JVM_OPTIMIZATION :=
JVM_CFLAGS_FEATURES += -O3 -flto
JVM_LDFLAGS_FEATURES += -O3 -flto -fuse-linker-plugin -fno-strict-aliasing
# Set JVM_OPTIMIZATION directly so other jvm-feature flags can override it
# later on if desired
JVM_OPTIMIZATION := HIGHEST_JVM
ifeq ($(call isCompiler, gcc), true)
JVM_CFLAGS_FEATURES += -flto -fuse-linker-plugin
JVM_LDFLAGS_FEATURES += -flto -fuse-linker-plugin -fno-strict-aliasing
endif
endif
ifeq ($(call check-jvm-feature, opt-size), true)