On Tue, 25 Nov 2025 13:12:06 GMT, Matthias Baesken <[email protected]> wrote:

>> The dead_strip linker option on macOS removes functions and data that are 
>> unreachable by the entry point or exported symbols.
>> Setting it can reduce the size of some binaries we generate quite a lot, for 
>> example (product build, Xcode 15 is used) :
>> (before -> after setting the option)
>> 
>> 1.4M -> 1.1M images/jdk/lib/libfontmanager.dylib
>> 264K -> 248K images/jdk/lib/libjavajpeg.dylib
>> 152K -> 132K images/jdk/lib/libjli.dylib
>> 388K -> 296K images/jdk/lib/liblcms.dylib
>> 164K -> 128K images/jdk/lib/libzip.dylib
>> 
>> 
>> and libjvm :
>> 
>> 20M -> 18M images/jdk/lib/server/libjvm.dylib
>> 146M -> 137M images/jdk/lib/server/libjvm.dylib.dSYM
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Use dead_strip on macOS arrch64 AND x86_64

For macOS x86_64 it works too at least for some of the libs. See the size 
without and with dead_strip 


1200 -> 1164    /jdk/lib/libawt_lwawt.dylib
1364 -> 1048    /jdk/lib/libfontmanager.dylib
636  -> 632     /jdk/lib/libfreetype.dylib
240  -> 236     /jdk/lib/libjavajpeg.dylib
280  -> 276     jdk/lib/libjdwp.dylib
92   -> 92      /jdk/lib/libjli.dylib
428  -> 320     /jdk/lib/liblcms.dylib
716  -> 688     /jdk/lib/libmlib_image.dylib
60   -> 60      /jdk/lib/libzip.dylib


For some strange reasons, it does not help on libzip and libjli .
But those are smaller anyway compared to aarch64.  (it is a bit surprising that 
libzip is twice as large on aarch64 !)

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

PR Comment: https://git.openjdk.org/jdk/pull/28319#issuecomment-3580564402

Reply via email to