[8u] RFR: 8210352: [hotspot] --with-extra-cxx-flags should not lower optimization

David Holmes david.holmes at oracle.com
Tue Sep 4 21:06:51 UTC 2018

Hi Severin,

On 5/09/2018 1:36 AM, Severin Gehwolf wrote:
> Hi,
> Could I please get reviews of this JDK 8-only change?
> The issue at hand is that the JDK 8 build seems to be inconsistent with
> later JDK builds (9+). When somebody passes
> --with-extra-c{,xx}-flags="-O2" to the OpenJDK build on JDK 9+ the JVM
> will get compiled with -O3 for a release type build. Not so on JDK 8.
> It gets compiled with -O2. The reason we are passing extra C flags via
> configure is to: a) get distro-wide optimization done b) allow for
> hardened builds. Without the --with-extra-c{,xx}-flags="-O2" flag,
> libjsig, libsaproc will get compiled with no optimization. That's what
> I'd like to fix. The proposed patch allows one to force -O2 for the JVM
> via OPT_EXTRAS make variable if so desired. Omitting OPT_EXTRAS=-O2
> allows one to get hotspot libraries optimized with -O2 and better.
> Thoughts?

I don't understand the motivation for this change. Compatibility with 
future versions is not a usual compatibility we care about. I'd also 
argue the behaviour in 8 seems more correct. If I set an extra cflag I 
expect it to be applied to all compilations - cross-compilation would be 
broken if that were not the case. I don't see why -On should be treated 
any differently.


> Bug: https://bugs.openjdk.java.net/browse/JDK-8210352
> webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8210352/webrev.01/
> Thanks,
> Severin

More information about the hotspot-dev mailing list