Hi Matthias,
I have reservations about turning this on by default and with no way to
control it. This seems like it should be something you have to opt-in to
initially while we gain some experience with it and ensure there are no
unexpected side-effects. After that it could be enabled by default.
David
On 15/01/2020 12:07 am, Baesken, Matthias wrote:
Hello, the following change enables the link-time section-gc for linux .
gcc and ld support enabling "garbage collection" of unused input sections.
This can be used to eliminate unused coding from native libraries (especially
when already compiling the objects with compiler flags -ffunction-sections
-fdata-sections .
See for details the --gc-sections and --print-gc-sections parts of the ld
documentation :
https://linux.die.net/man/1/ld
We had this enabled already for linux s390x , with
https://bugs.openjdk.java.net/browse/JDK-8234525
8234525: enable link-time section-gc for linux s390x to remove unused code .
This time we enable it too for the other linux platforms .
For the other platforms I do not enable it for JVM, just for the JDK libs. The
reason is that the serviceability agent (not supported on linux s390x ) is
not (yet) ready for the optimization .
Below you see the results , for some libraries a significant size reduction
can be achieved .
Results from linux x86_64 product builds :
without / with ltgc
320K / 300K /images/jdk/lib/libsunec.so <-------------------------
36K / 36K /images/jdk/lib/libdt_socket.so
280K / 276K /images/jdk/lib/libjdwp.so
23M / 23M /images/jdk/lib/server/libjvm.so <---- not set for libjvm.so
for x86_64
16K / 16K /images/jdk/lib/server/libjsig.so
72K / 72M /images/jdk/lib/libverify.so
84K / 84M /images/jdk/lib/libjli.so
16K / 16K /images/jdk/lib/libjsig.so
196K / 196K /images/jdk/lib/libjava.so
44K / 44K /images/jdk/lib/libzip.so
144K / 136K /images/jdk/lib/libjimage.so
112K / 112K /images/jdk/lib/libnet.so
100K / 100K /images/jdk/lib/libnio.so
36K / 36K /images/jdk/lib/libsctp.so
576K / 556K /images/jdk/lib/libmlib_image.so
752K / 752K /images/jdk/lib/libawt.so
260K / 252K /images/jdk/lib/libjavajpeg.so
784K / 784K /images/jdk/lib/libfreetype.so
368K / 236K /images/jdk/lib/libsplashscreen.so <-------------------------
88K / 88K /images/jdk/lib/libjsound.so
472K / 468K /images/jdk/lib/libawt_xawt.so
564K / 404K /images/jdk/lib/liblcms.so <--------------------------
48K / 48K /images/jdk/lib/libawt_headless.so
12K / 12K /images/jdk/lib/libjawt.so
1.5M / 900K /images/jdk/lib/libfontmanager.so <------------------------------
12K / 12K /images/jdk/lib/libjaas.so
92K / 92K /images/jdk/lib/libj2pkcs11.so
16K / 16K /images/jdk/lib/libattach.so
8.0K / 8.0K /images/jdk/lib/librmi.so
56K / 56K /images/jdk/lib/libinstrument.so
16K / 16K /images/jdk/lib/libprefs.so
52K / 52K /images/jdk/lib/libj2gss.so
12K / 12K /images/jdk/lib/libmanagement_agent.so
36K / 32K /images/jdk/lib/libmanagement.so
16K / 16K /images/jdk/lib/libextnet.so
20K / 20K /images/jdk/lib/libj2pcsc.so
40K / 40K /images/jdk/lib/libmanagement_ext.so
60K / 60K /images/jdk/lib/libsaproc.so
Bug/webrev :
https://bugs.openjdk.java.net/browse/JDK-8236714
http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.2/
Thanks, Matthias