Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Looks good. /Erik On 2020-01-24 01:27, Baesken, Matthias wrote: Hi Erik, thanks for the comments, new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.7/ Best regards, Matthias Hello, That's better, but there are still some issues. flags-cflags.m4 Code is repeated in both if and else block. jdk-options.m4 The default is now true for all platforms. I would suggest moving the s390x conditional down into an elif after the elif for "no". LibCommon.gmk Please revert whole file. /Erik On 2020-01-23 05:15, Baesken, Matthias wrote: Hi Erik, new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.6/ I moved the settings back into the m4 files . Best regards, Matthias Hello Matthias, You can keep the setting up of all the flags in flags-cflags.m4 and flags-ldflags.m4 based on the value of ENABLE_LINKTIME_GC. You can also default the value of this new parameter to true for s390x to keep the current behavior for that platform. As it is in this patch, the JVM flags for s390x are setup in configure while the JDK flags are in make, which gets confusing I think. /Erik On 2020-01-22 05:33, Baesken, Matthias wrote: Hi Magnus / David, here is a new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.4/ it supports now a configure switch --enable-linktime-gc=yes that needs to be set to enable the link time section gc . Exception is linuxs390x where we already have the feature enabled (and keep it enabled always for LIB_JVM). Best regards, Matthias From: Baesken, Matthias Sent: Freitag, 17. Januar 2020 12:44 To: Magnus Ihse Bursie ; David Holmes ; 'build-dev@openjdk.java.net' ; 'hotspot-...@openjdk.java.net' Subject: RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code * Matthias: Have a look at some recently added option to get an indication of the best practice in adding new options. There are some ways to easily make this incorrect Hi Magnus, do you have a good/”best practice” example (not that I catch a bad one 😉 ) ? Best regards, Matthias
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Thanks for the review ! Erik, are you fine with the latest change too ? Best regards, Matthias > On 2020-01-24 10:27, Baesken, Matthias wrote: > > Hi Erik, thanks for the comments, new webrev : > > > > http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.7/ > Looks good to me. Sorry for not being able to provide an example in a > timely matter. Good thing you found one yourself. :) > > /Magnus > > > > Best regards, Matthias
Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
On 2020-01-24 10:27, Baesken, Matthias wrote: Hi Erik, thanks for the comments, new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.7/ Looks good to me. Sorry for not being able to provide an example in a timely matter. Good thing you found one yourself. :) /Magnus Best regards, Matthias Hello, That's better, but there are still some issues. flags-cflags.m4 Code is repeated in both if and else block. jdk-options.m4 The default is now true for all platforms. I would suggest moving the s390x conditional down into an elif after the elif for "no". LibCommon.gmk Please revert whole file. /Erik On 2020-01-23 05:15, Baesken, Matthias wrote: Hi Erik, new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.6/ I moved the settings back into the m4 files . Best regards, Matthias Hello Matthias, You can keep the setting up of all the flags in flags-cflags.m4 and flags-ldflags.m4 based on the value of ENABLE_LINKTIME_GC. You can also default the value of this new parameter to true for s390x to keep the current behavior for that platform. As it is in this patch, the JVM flags for s390x are setup in configure while the JDK flags are in make, which gets confusing I think. /Erik On 2020-01-22 05:33, Baesken, Matthias wrote: Hi Magnus / David, here is a new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.4/ it supports now a configure switch --enable-linktime-gc=yes that needs to be set to enable the link time section gc . Exception is linuxs390x where we already have the feature enabled (and keep it enabled always for LIB_JVM). Best regards, Matthias From: Baesken, Matthias Sent: Freitag, 17. Januar 2020 12:44 To: Magnus Ihse Bursie ; David Holmes ; 'build-dev@openjdk.java.net' ; 'hotspot-...@openjdk.java.net' Subject: RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code * Matthias: Have a look at some recently added option to get an indication of the best practice in adding new options. There are some ways to easily make this incorrect Hi Magnus, do you have a good/”best practice” example (not that I catch a bad one 😉 ) ? Best regards, Matthias
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hi Erik, thanks for the comments, new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.7/ Best regards, Matthias > Hello, > > That's better, but there are still some issues. > > flags-cflags.m4 > > Code is repeated in both if and else block. > > jdk-options.m4 > > The default is now true for all platforms. I would suggest moving the > s390x conditional down into an elif after the elif for "no". > > LibCommon.gmk > > Please revert whole file. > > /Erik > > On 2020-01-23 05:15, Baesken, Matthias wrote: > > Hi Erik, new webrev : > > > > http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.6/ > > > > I moved the settings back into the m4 files . > > > > Best regards, Matthias > > > >> Hello Matthias, > >> > >> You can keep the setting up of all the flags in flags-cflags.m4 and > >> flags-ldflags.m4 based on the value of ENABLE_LINKTIME_GC. You can > also > >> default the value of this new parameter to true for s390x to keep the > >> current behavior for that platform. As it is in this patch, the JVM > >> flags for s390x are setup in configure while the JDK flags are in make, > >> which gets confusing I think. > >> > >> /Erik > >> > >> > >> On 2020-01-22 05:33, Baesken, Matthias wrote: > >>> Hi Magnus / David, here is a new webrev : > >>> > >>> > >>> http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.4/ > >>> > >>> > >>> it supports now a configure switch --enable-linktime-gc=yes that needs > to > >> be set to enable the link time section gc . > >>> Exception is linuxs390x where we already have the feature enabled > (and > >> keep it enabled always for LIB_JVM). > >>> Best regards, Matthias > >>> > >>> > >>> > >>> From: Baesken, Matthias > >>> Sent: Freitag, 17. Januar 2020 12:44 > >>> To: Magnus Ihse Bursie ; David > Holmes > >> ; 'build-dev@openjdk.java.net' >> d...@openjdk.java.net>; 'hotspot-...@openjdk.java.net' >> d...@openjdk.java.net> > >>> Subject: RE: RFR: 8236714: enable link-time section-gc for linux to > remove > >> unused code > >>> > >>> > >>> * Matthias: Have a look at some recently added option to get an > >> indication of the best practice in adding new options. There are some > ways to > >> easily make this incorrect > >>> Hi Magnus, do you have a good/”best practice” example (not that I > catch a > >> bad one 😉 ) ? > >>> Best regards, Matthias > >>>
Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hello, That's better, but there are still some issues. flags-cflags.m4 Code is repeated in both if and else block. jdk-options.m4 The default is now true for all platforms. I would suggest moving the s390x conditional down into an elif after the elif for "no". LibCommon.gmk Please revert whole file. /Erik On 2020-01-23 05:15, Baesken, Matthias wrote: Hi Erik, new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.6/ I moved the settings back into the m4 files . Best regards, Matthias Hello Matthias, You can keep the setting up of all the flags in flags-cflags.m4 and flags-ldflags.m4 based on the value of ENABLE_LINKTIME_GC. You can also default the value of this new parameter to true for s390x to keep the current behavior for that platform. As it is in this patch, the JVM flags for s390x are setup in configure while the JDK flags are in make, which gets confusing I think. /Erik On 2020-01-22 05:33, Baesken, Matthias wrote: Hi Magnus / David, here is a new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.4/ it supports now a configure switch --enable-linktime-gc=yes that needs to be set to enable the link time section gc . Exception is linuxs390x where we already have the feature enabled (and keep it enabled always for LIB_JVM). Best regards, Matthias From: Baesken, Matthias Sent: Freitag, 17. Januar 2020 12:44 To: Magnus Ihse Bursie ; David Holmes ; 'build-dev@openjdk.java.net' ; 'hotspot-...@openjdk.java.net' Subject: RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code * Matthias: Have a look at some recently added option to get an indication of the best practice in adding new options. There are some ways to easily make this incorrect Hi Magnus, do you have a good/”best practice” example (not that I catch a bad one 😉 ) ? Best regards, Matthias
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hi Erik, new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.6/ I moved the settings back into the m4 files . Best regards, Matthias > > Hello Matthias, > > You can keep the setting up of all the flags in flags-cflags.m4 and > flags-ldflags.m4 based on the value of ENABLE_LINKTIME_GC. You can also > default the value of this new parameter to true for s390x to keep the > current behavior for that platform. As it is in this patch, the JVM > flags for s390x are setup in configure while the JDK flags are in make, > which gets confusing I think. > > /Erik > > > On 2020-01-22 05:33, Baesken, Matthias wrote: > > Hi Magnus / David, here is a new webrev : > > > > > > http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.4/ > > > > > > it supports now a configure switch --enable-linktime-gc=yes that needs to > be set to enable the link time section gc . > > > > Exception is linuxs390x where we already have the feature enabled (and > keep it enabled always for LIB_JVM). > > > > Best regards, Matthias > > > > > > > > From: Baesken, Matthias > > Sent: Freitag, 17. Januar 2020 12:44 > > To: Magnus Ihse Bursie ; David Holmes > ; 'build-dev@openjdk.java.net' d...@openjdk.java.net>; 'hotspot-...@openjdk.java.net' d...@openjdk.java.net> > > Subject: RE: RFR: 8236714: enable link-time section-gc for linux to remove > unused code > > > > > > > >* Matthias: Have a look at some recently added option to get an > indication of the best practice in adding new options. There are some ways to > easily make this incorrect > > > > Hi Magnus, do you have a good/”best practice” example (not that I catch a > bad one 😉 ) ? > > > > Best regards, Matthias > >
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hi Erik, okay I'll check that . I had the impression I would have ordering issues of the m4 files and how they end up in the generated-configure.sh but looks like that’s not the case . Best regards, Matthias > > Hello Matthias, > > You can keep the setting up of all the flags in flags-cflags.m4 and > flags-ldflags.m4 based on the value of ENABLE_LINKTIME_GC. You can also > default the value of this new parameter to true for s390x to keep the > current behavior for that platform. As it is in this patch, the JVM > flags for s390x are setup in configure while the JDK flags are in make, > which gets confusing I think. > > /Erik >
Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hello Matthias, You can keep the setting up of all the flags in flags-cflags.m4 and flags-ldflags.m4 based on the value of ENABLE_LINKTIME_GC. You can also default the value of this new parameter to true for s390x to keep the current behavior for that platform. As it is in this patch, the JVM flags for s390x are setup in configure while the JDK flags are in make, which gets confusing I think. /Erik On 2020-01-22 05:33, Baesken, Matthias wrote: Hi Magnus / David, here is a new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.4/ it supports now a configure switch --enable-linktime-gc=yes that needs to be set to enable the link time section gc . Exception is linuxs390x where we already have the feature enabled (and keep it enabled always for LIB_JVM). Best regards, Matthias From: Baesken, Matthias Sent: Freitag, 17. Januar 2020 12:44 To: Magnus Ihse Bursie ; David Holmes ; 'build-dev@openjdk.java.net' ; 'hotspot-...@openjdk.java.net' Subject: RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code * Matthias: Have a look at some recently added option to get an indication of the best practice in adding new options. There are some ways to easily make this incorrect Hi Magnus, do you have a good/”best practice” example (not that I catch a bad one 😉 ) ? Best regards, Matthias
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hi Magnus / David, here is a new webrev : http://cr.openjdk.java.net/~mbaesken/webrevs/8236714.4/ it supports now a configure switch --enable-linktime-gc=yes that needs to be set to enable the link time section gc . Exception is linuxs390x where we already have the feature enabled (and keep it enabled always for LIB_JVM). Best regards, Matthias From: Baesken, Matthias Sent: Freitag, 17. Januar 2020 12:44 To: Magnus Ihse Bursie ; David Holmes ; 'build-dev@openjdk.java.net' ; 'hotspot-...@openjdk.java.net' Subject: RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code * Matthias: Have a look at some recently added option to get an indication of the best practice in adding new options. There are some ways to easily make this incorrect Hi Magnus, do you have a good/”best practice” example (not that I catch a bad one 😉 ) ? Best regards, Matthias
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
* Matthias: Have a look at some recently added option to get an indication of the best practice in adding new options. There are some ways to easily make this incorrect Hi Magnus, do you have a good/”best practice” example (not that I catch a bad one 😉 ) ? Best regards, Matthias On 2020-01-16 10:30, David Holmes wrote: Hi Matthias, On 16/01/2020 6:10 pm, Baesken, Matthias wrote: Hi David, sure we can introduce a way to switch this on/off. Thanks. There is already something similar for the link-time optimization (flto) , see the feature JvmFeatures.gmk 180 ifeq ($(call check-jvm-feature, link-time-opt), true) 190 ifeq ($(call check-jvm-feature, link-time-opt), false) hotspot.m4 29 static-build link-time-opt aot jfr" 502 JVM_FEATURES_link_time_opt="link-time-opt" Yep familiar with that from Minimal VM and SE Embedded days :) Should we have "link-time-gc" additionally to " link-time-opt" ? (however it would be a bit misleading that it is a "JVM" feature , but except linux s390x it is only changing the build of the JDK libs) . I agree the definition of this as a "JVM" feature is a bit odd/misleading. Perhaps the build folk have a suggestion on how to refactor this kind of option into something more general? In the meantime having link-time-gc sit alongside link-time-opt seems acceptable to me. We don't have the concept of "JDK features", akin to "JVM features". Maybe we should have. It's an idea worth exploring, anyway. The way we currently do on/off features for the entire JDK is by using autoconf options. So, in this case, --enable-link-time-gc, or something like that. It might just as well be on by default, which gives us a --disable-link-time-gc instead. (I understand David's reservation not about this being the default, just that it is not possible to simply turn off.) Matthias: Have a look at some recently added option to get an indication of the best practice in adding new options. There are some ways to easily make this incorrect, and our code is full of old examples that does this unnecessary complex, or downright wrong. (These should be fixed, and we should probably introduce a simpler API for doing this, and so on... I'll address those as soon as time permits.) /Magnus
Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
On 2020-01-16 10:30, David Holmes wrote: Hi Matthias, On 16/01/2020 6:10 pm, Baesken, Matthias wrote: Hi David, sure we can introduce a way to switch this on/off. Thanks. There is already something similar for the link-time optimization (flto) , see the feature JvmFeatures.gmk 180 ifeq ($(call check-jvm-feature, link-time-opt), true) 190 ifeq ($(call check-jvm-feature, link-time-opt), false) hotspot.m4 29 static-build link-time-opt aot jfr" 502 JVM_FEATURES_link_time_opt="link-time-opt" Yep familiar with that from Minimal VM and SE Embedded days :) Should we have "link-time-gc" additionally to " link-time-opt" ? (however it would be a bit misleading that it is a "JVM" feature , but except linux s390x it is only changing the build of the JDK libs) . I agree the definition of this as a "JVM" feature is a bit odd/misleading. Perhaps the build folk have a suggestion on how to refactor this kind of option into something more general? In the meantime having link-time-gc sit alongside link-time-opt seems acceptable to me. We don't have the concept of "JDK features", akin to "JVM features". Maybe we should have. It's an idea worth exploring, anyway. The way we currently do on/off features for the entire JDK is by using autoconf options. So, in this case, --enable-link-time-gc, or something like that. It might just as well be on by default, which gives us a --disable-link-time-gc instead. (I understand David's reservation not about this being the default, just that it is not possible to simply turn off.) Matthias: Have a look at some recently added option to get an indication of the best practice in adding new options. There are some ways to easily make this incorrect, and our code is full of old examples that does this unnecessary complex, or downright wrong. (These should be fixed, and we should probably introduce a simpler API for doing this, and so on... I'll address those as soon as time permits.) /Magnus Thanks, David Best regards, Matthias 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.
Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hi Matthias, On 16/01/2020 6:10 pm, Baesken, Matthias wrote: Hi David, sure we can introduce a way to switch this on/off. Thanks. There is already something similar for the link-time optimization (flto) , see the feature JvmFeatures.gmk 180 ifeq ($(call check-jvm-feature, link-time-opt), true) 190 ifeq ($(call check-jvm-feature, link-time-opt), false) hotspot.m4 29 static-build link-time-opt aot jfr" 502 JVM_FEATURES_link_time_opt="link-time-opt" Yep familiar with that from Minimal VM and SE Embedded days :) Should we have "link-time-gc" additionally to " link-time-opt" ? (however it would be a bit misleading that it is a "JVM" feature , but except linux s390x it is only changing the build of the JDK libs) . I agree the definition of this as a "JVM" feature is a bit odd/misleading. Perhaps the build folk have a suggestion on how to refactor this kind of option into something more general? In the meantime having link-time-gc sit alongside link-time-opt seems acceptable to me. Thanks, David Best regards, Matthias 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.
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hi David, sure we can introduce a way to switch this on/off. There is already something similar for the link-time optimization (flto) , see the feature JvmFeatures.gmk 180 ifeq ($(call check-jvm-feature, link-time-opt), true) 190 ifeq ($(call check-jvm-feature, link-time-opt), false) hotspot.m4 29 static-build link-time-opt aot jfr" 502 JVM_FEATURES_link_time_opt="link-time-opt" Should we have "link-time-gc" additionally to " link-time-opt" ? (however it would be a bit misleading that it is a "JVM" feature , but except linux s390x it is only changing the build of the JDK libs) . Best regards, Matthias > > 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. >
Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
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
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hi Erik, I did not notice slowdowns in our night makes . Looking at a specific test machine I use (x86_64, build JOBS hardwired set to 12 ) I get around 6 minutes build time with and without the feature . ( but you have to take into account that the link-time section-gc on x86_64in my patch is only enabled for the smaller JDK libs and not libjvm.so ) Best regards, Matthias > > Given the discussion regarding lto on hotspot and the extreme increased > build time, have you noticed any difference in build times with this patch? > > /Erik >
Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Given the discussion regarding lto on hotspot and the extreme increased build time, have you noticed any difference in build times with this patch? /Erik On 2020-01-15 00:27, Baesken, Matthias wrote: Hi Erik, thanks for the review and for forwarding , you are correct corelibs-dev is probably interested in this as well . Best regards, Matthias (adding core-libs-dev) Change looks good to me, but would like input from at least someone in core-libs. /Erik On 2020-01-14 06:07, 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
RE: RFR: 8236714: enable link-time section-gc for linux to remove unused code
Hi Erik, thanks for the review and for forwarding , you are correct corelibs-dev is probably interested in this as well . Best regards, Matthias > (adding core-libs-dev) > > Change looks good to me, but would like input from at least someone in > core-libs. > > /Erik > > On 2020-01-14 06:07, 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
Re: RFR: 8236714: enable link-time section-gc for linux to remove unused code
(adding core-libs-dev) Change looks good to me, but would like input from at least someone in core-libs. /Erik On 2020-01-14 06:07, 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