Skip to content

Commit 85fedbf

Browse files
committed
8344607: Link Time Optimization - basic support for clang
Reviewed-by: lucy, jkern, ihse
1 parent 5a0899f commit 85fedbf

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

make/hotspot/lib/JvmFeatures.gmk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ ifeq ($(call check-jvm-feature, link-time-opt), true)
174174
-fno-fat-lto-objects
175175
JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto=auto \
176176
-fuse-linker-plugin -fno-strict-aliasing
177+
else ifeq ($(call isCompiler, clang), true)
178+
JVM_CFLAGS_FEATURES += -flto -fno-strict-aliasing
179+
ifeq ($(call isBuildOs, aix), true)
180+
JVM_CFLAGS_FEATURES += -ffat-lto-objects
181+
endif
182+
JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto -fno-strict-aliasing
177183
else ifeq ($(call isCompiler, microsoft), true)
178184
JVM_CFLAGS_FEATURES += -GL
179185
JVM_LDFLAGS_FEATURES += -LTCG:INCREMENTAL

src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ static inline void atomic_copy64(const volatile void *src, volatile void *dst) {
501501
}
502502

503503
extern "C" {
504+
// needs local assembler label '1:' to avoid trouble when using linktime optimization
504505
int SpinPause() {
505506
// We don't use StubRoutines::aarch64::spin_wait stub in order to
506507
// avoid a costly call to os::current_thread_enable_wx() on MacOS.
@@ -523,14 +524,14 @@ extern "C" {
523524
// to entry for case SpinWait::NOP
524525
" add %[d], %[d], %[o] \n"
525526
" br %[d] \n"
526-
" b SpinPause_return \n" // case SpinWait::NONE (-1)
527+
" b 1f \n" // case SpinWait::NONE (-1)
527528
" nop \n" // padding
528529
" nop \n" // case SpinWait::NOP ( 0)
529-
" b SpinPause_return \n"
530+
" b 1f \n"
530531
" isb \n" // case SpinWait::ISB ( 1)
531-
" b SpinPause_return \n"
532+
" b 1f \n"
532533
" yield \n" // case SpinWait::YIELD ( 2)
533-
"SpinPause_return: \n"
534+
"1: \n"
534535
: [d]"=&r"(br_dst)
535536
: [o]"r"(off)
536537
: "memory");

0 commit comments

Comments
 (0)