RFR: 8370438: Offer link time optimization support on library level [v5]

Erik Joelsson erikj at openjdk.org
Thu Nov 6 13:52:24 UTC 2025


On Thu, 6 Nov 2025 09:09:52 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> We still add CXX_O_FLAG_HIGHEST_JVM to the JVM_LDFLAGS_FEATURES for gcc/clang , but not for msvc. Not sure why.  So there is still a bit of difference between compilers.
>
> That's due to how the toolchains work, with VC you're passing the options directly to the linker, while for gcc/clang you're passing the optimization flag to the driver, which understands the optimization option, unlike link.exe (Technically you're passing it to the compiler for gcc/clang I believe, both of them use the compiler's middle end to optimize your code during the link step when LTO is enabled from what I recall)

> We still add CXX_O_FLAG_HIGHEST_JVM to the JVM_LDFLAGS_FEATURES for gcc/clang , but not for msvc. Not sure why. So there is still a bit of difference between compilers.

That is what I meant.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27976#discussion_r2499024967


More information about the client-libs-dev mailing list