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