On Tue, 3 Dec 2024 16:46:04 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:
>> Support the clang toolchain when link time optimization is configured. >> Please note that this is NOT intended to enable lto by default and NOT to >> fix all possible clang-supporting builds or test issues . >> >> It works on my Linux x86_64 SUSE 15 test machine with clang15.0.7, also on >> macOS with Xcode 13.1 devkit and Xcode 15.4 . >> >> To be able to build on macOS with Xcode, I had to deal with one issue. The >> lto-link process runs into this error >> >> >> ld: <inline asm>:11:1: symbol 'SpinPause_return' is already defined >> SpinPause_return: >> ^ >> for architecture arm64 >> clang: error: linker command failed with exit code 1 (use -v to see >> invocation) >> >> >> Seems that when building with LTO, the inline assembler code in >> SpinPause() is not handled well. In the lto inlining the label >> SpinPause_return is generated multiple times and causes an 'already defined' >> error. This goes away when adding NOINLINE to this function. >> Linux/clang did not show this issue, probably the toolchain there does not >> have the error. > > Matthias Baesken has updated the pull request incrementally with one > additional commit since the last revision: > > use fat lto objects on AIX/clang Marked as reviewed by jkern (Committer). make/hotspot/lib/JvmFeatures.gmk line 182: > 180: JVM_CFLAGS_FEATURES += -ffat-lto-objects > 181: endif > 182: JVM_LDFLAGS_FEATURES += $(CXX_O_FLAG_HIGHEST_JVM) -flto > -fno-strict-aliasing LGTM. ffat-lto-objects is needed on AIX, because gtest/gtestLauncher.cpp is compiled with -flto for libjvm.so, but also linked to libjvm/gtest/gtestLauncher without -flto in the link statement. ------------- PR Review: https://git.openjdk.org/jdk/pull/22412#pullrequestreview-2481095181 PR Review Comment: https://git.openjdk.org/jdk/pull/22412#discussion_r1871014580