8344607: Link Time Optimization - basic support for clang

Reviewed-by: lucy, jkern, ihse
This commit is contained in:
Matthias Baesken 2024-12-05 16:44:18 +00:00
parent 5a0899fc09
commit 85fedbf668
2 changed files with 11 additions and 4 deletions

View File

@ -174,6 +174,12 @@ ifeq ($(call check-jvm-feature, link-time-opt), true)
-fno-fat-lto-objects
JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto=auto \
-fuse-linker-plugin -fno-strict-aliasing
else ifeq ($(call isCompiler, clang), true)
JVM_CFLAGS_FEATURES += -flto -fno-strict-aliasing
ifeq ($(call isBuildOs, aix), true)
JVM_CFLAGS_FEATURES += -ffat-lto-objects
endif
JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto -fno-strict-aliasing
else ifeq ($(call isCompiler, microsoft), true)
JVM_CFLAGS_FEATURES += -GL
JVM_LDFLAGS_FEATURES += -LTCG:INCREMENTAL

View File

@ -501,6 +501,7 @@ static inline void atomic_copy64(const volatile void *src, volatile void *dst) {
}
extern "C" {
// needs local assembler label '1:' to avoid trouble when using linktime optimization
int SpinPause() {
// We don't use StubRoutines::aarch64::spin_wait stub in order to
// avoid a costly call to os::current_thread_enable_wx() on MacOS.
@ -523,14 +524,14 @@ extern "C" {
// to entry for case SpinWait::NOP
" add %[d], %[d], %[o] \n"
" br %[d] \n"
" b SpinPause_return \n" // case SpinWait::NONE (-1)
" b 1f \n" // case SpinWait::NONE (-1)
" nop \n" // padding
" nop \n" // case SpinWait::NOP ( 0)
" b SpinPause_return \n"
" b 1f \n"
" isb \n" // case SpinWait::ISB ( 1)
" b SpinPause_return \n"
" b 1f \n"
" yield \n" // case SpinWait::YIELD ( 2)
"SpinPause_return: \n"
"1: \n"
: [d]"=&r"(br_dst)
: [o]"r"(off)
: "memory");