Skip to content

Commit 1ed03d8

Browse files
TheShermanTankermagicus
authored andcommitted
8292226: Prepare make for better Link Time Optimization support
Reviewed-by: ihse
1 parent 79597f1 commit 1ed03d8

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

make/common/Utils.gmk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ isBuildCpu = \
367367
isBuildCpuArch = \
368368
$(strip $(if $(filter $(OPENJDK_BUILD_CPU_ARCH), $1), true, false))
369369

370+
isCompiler = \
371+
$(strip $(if $(filter $(TOOLCHAIN_TYPE), $1), true, false))
372+
370373
################################################################################
371374
# Converts a space separated list to a comma separated list.
372375
#

make/hotspot/lib/JvmFeatures.gmk

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,13 @@ endif
169169
################################################################################
170170

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

180181
ifeq ($(call check-jvm-feature, opt-size), true)

0 commit comments

Comments
 (0)