RFR (S): JDK-8150201 Restore missing -g flags to files with OPT_CFLAGS/per-file

David Holmes david.holmes at oracle.com
Thu Feb 18 23:40:27 UTC 2016

Hi Magnus,

On 19/02/2016 9:16 AM, Magnus Ihse Bursie wrote:
> There seems to be a bit of confusion as to OPT_CFLAGS meant "CFLAGS for
> optimization" or "CFLAGS for optimized/product build". Some usages seems
> to suggest the first interpretation, while other usages seems to have
> made the second (where OPT_CFLAGS align with
> The first interpretation seems to have been used for the code that make
> it possible to override OPT_CFLAGS on a per-file basis by setting e.g.
> OPT_CFLAGS/foo.o is set. In this case, the general value of OPT_CFLAGS
> is discarded, including any -O flags.
> However, the second interpretation seems to have been used for FDS,
> where -g (or -g0 -xs on solaris) are added to OPT_CFLAGS.
> The end result is that whenever the OPT_CFLAGS/foo.o mechanism is used,
> the FDS -g flag is lost. :-(

As I understand it if you use per-file flags then you are taking full 
responsibility for that set of flags and so have to ensure that any 
desired "common" flags are also included. But I can understand if other 
people have not seen it that way, or realized that was the way it worked.

> This patch is a minimal fix to restore the -g flag to these files.

Changes seem fine as you have done them.

> A more general approach to fix this was originally suggested as part of
> JDK-8142909, but was deemed inadequate. After some discussion, the
> entire problem with the missing -g flags was dropped from that bug.
> However, one of the key points in the discussion was that an explicit
> add of -g would be a better solution, which is what I have adopted here
> (short of a major rewrite of the flag handling in the old build system,
> which is not going to happen). I have also made a more thorough check
> this time to really catch all such issues (at least for default Oracle
> builds).

Defining a FULL_DEBUG_SYMBOLS_CFLAGS that was always added to CFLAGS and 
not caught up with the XXX_CFLAGS would be simpler, and doesn't quite 
amount to a full rewrite of the flags support.  But I understand not 
wanting to waste cycles on this.


> The main reason for bringing this change in now is to make it possible
> to compare the build results between the upcoming new hotspot build, and
> the old. Since the new build always adds -g to all files (if we need
> debug symbols, that is), there will be huge discrepances between the two
> build system in the affected files.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8150201
> WebRev:
> http://cr.openjdk.java.net/~ihse/JDK-8150201-restore-missing-g-flag/webrev.01
> /Magnus

More information about the hotspot-runtime-dev mailing list