RFR: 8371626: [linux] use icf=all for linking libraries [v3]

Matthias Baesken mbaesken at openjdk.org
Tue Nov 25 13:00:32 UTC 2025


On Wed, 12 Nov 2025 15:46:09 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> Identical code folding can reduce the size of some libs, especially libjvm. However not all linkers support the flag/feature so we have to limit it to some environments.
>> See for example this manpage :
>> https://manpages.debian.org/testing/lld-7/ld.lld-7.1
>> 
>> 
>> sizes of libjvm.so with / without -icf=all
>> linux aarch64 : 25888 / 27112 K
>> linux x86_64 : 27952 / 29072 K
>> 
>> 
>> (for most other native libs the identical code folding has no effect, because there is nothing to fold)
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Limit icf to release builds

Thanks for the review !
Maybe someone from build-dev show review too ?

> (for most other native libs the identical code folding has no effect, because there is nothing to fold)

We could limit the usage of the flag to libjvm where it shows effect ; this would be similar to Windows , where we set a similar flag also only for jvm lib 
`BASIC_LDFLAGS_JVM_ONLY="-opt:icf,8 -subsystem:windows"`

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

PR Comment: https://git.openjdk.org/jdk/pull/28236#issuecomment-3575519268


More information about the hotspot-dev mailing list