On Fri, 24 Oct 2025 12:58:15 GMT, Matthias Baesken <[email protected]> wrote:

> We currently have support for LTO (link time optimization) for 
> Hotspot/libjvm, that can be enabled as a JVM feature.
> But for other JDK native libs, we do not have support for this feature.
> LTO and sometimes lead to faster and also in some cases smaller binaries, so 
> support for this might be interesting also for other libs and not only libjvm.

make/autoconf/flags-ldflags.m4 line 72:

> 70:         -fPIC"
> 71: 
> 72:     LDFLAGS_LTO="-flto=auto -fuse-linker-plugin -fno-strict-aliasing"

I notice that the compiler args for GCC and Clang are different, but the linker 
args are the same. Just want to make sure that's intentional.

make/common/NativeCompilation.gmk line 101:

> 99: #   SYSROOT_LDFLAGS the linker flags for using the specific sysroot
> 100: #   OPTIMIZATION sets optimization level to NONE, LOW, HIGH, HIGHEST, 
> HIGHEST_JVM, SIZE
> 101: #   LINK_TIME_OPTIMIZATION if set to YES, it enables additionally link 
> time optimization

For boolean options, we use the vales `true`/`false`.

make/common/native/Flags.gmk line 67:

> 65: 
> 66:   ifneq (, $$($1_LINK_TIME_OPTIMIZATION))
> 67:     ifeq ($$($1_LINK_TIME_OPTIMIZATION), YES)

No need to first check if the parameter is not empty.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27976#discussion_r2460453358
PR Review Comment: https://git.openjdk.org/jdk/pull/27976#discussion_r2460465286
PR Review Comment: https://git.openjdk.org/jdk/pull/27976#discussion_r2460467382

Reply via email to