On Fri, 30 Jan 2026 12:41:33 GMT, Matthias Baesken <[email protected]> wrote:

>> libjimage has a few unused functions/methods; those are listed when logging 
>> elimination with  -Wl,--gc-sections -Wl,--print-gc-sections .
>> We could remove them (or with if are still needed for completeness  put them 
>> into  #if 0 ) to reduce lib size on Linux and AIX.
>> On Windows and macOS it seems the compiler/linker default settings are good 
>> enough to eliminate the code.
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Adjust COPYRIGHT headers

one interesting finding seems to be that  the linktime-gc can eliminate more 
methods like
`ZipDecompressor::decompress(void*, unsigned long, void*, unsigned long, 
char**)`

which is printed as removed  

`
/usr/lib64/gcc/x86_64-suse-linux/14/../../../../x86_64-suse-linux/bin/ld: 
removing unused section '.text._ZN15ZipDecompressor10decompressEPvyS0_yPPc' in 
file '/builddir/support/native/java.base/libjimage/imageDecompressor.o'`

but this is not unused/uncalled in our codebase.  I think it is inlined at the 
1 or 2  points were it is used.  But the method is still generated into the 
library even in case that it is always inlined ;  it may be difficult to 
address this with the usual linker settings on Linux  (means without 
linktime-gc or LTO or similar stuff ) .

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

PR Comment: https://git.openjdk.org/jdk/pull/29502#issuecomment-3823600664

Reply via email to