Allow --with-extra-cxxflags to work with HotSpot.
David Holmes
david.holmes at oracle.com
Tue Jul 21 23:20:25 UTC 2015
Hi Ian,
On 22/07/2015 3:01 AM, Ian Rogers wrote:
> The following (modest) patch against jdk9dev allows the top-level configure
> with --with-extra-cxxflags to pass options to the HotSpot build. An example
> would be:
>
> configure --fastdebug --with-extra-cxxflags=-std=c++11
>
> Unless --with-extra-cxxflags is specified the option has no effect. I'd
> like to work to get this merged into jdk9dev and would appreciate any help.
Unfortunately this is not quite as simple as it appears due to the mess
in the hotspot build system regarding flags usage. Once upon a time we
had CFLAGS and CPPFLAGS but there was confusion whether CPP meant C++ or
C-pre-processor. It actually meant the latter but was mistakenly thought
to be the former (g++ args versus gcc args) and was eventually renamed
to CXXFLAGS. This results in quite a mess because we have eg:
./linux/makefiles/rules.make:CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS)
./linux/makefiles/rules.make:CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS)
which combines the "C" flags (which were always intended to just be the
compiler flags, which was a combined C/C++ compiler anyway) and the
(now) C++ flags (most of which are not at all C++ specific). So it will
get the EXTRA_CFLAGS and the EXTRA_CXXFLAGS on each compilation.
Then things get worse because hotspot uses both sets of flags but the
JDK uses CXXFLAGS as the primary compiler flags. So taking
cross-compilation as an example, we set EXTRA_CFLAGS to hold the
cross-compiler flags used in hotspot, and set EXTRA_CXXFLAGS to hold the
cross-compiler flags for the JDK build. So with your proposed change we
will now get the cross-compiler flags specified twice on each
command-line in the hotspot build. Whether that is harmful I don't know
- I'm just pointing out that this is far from clear cut and would need
some resources to establish that the change is indeed safe.
This should all be resolved once the hotspot build is converted to be a
full configure-based build. And because that is in the pipeline we avoid
doing any major surgery to the (fragile) hotspot build system.
David
-----
> Thanks,
> Ian Rogers, Google.
>
> ---
> Allow --with-extra-cxxflags to work with HotSpot.
>
> Pass down EXTRA_CXXFLAGS from gnumake's invocation or environment.
>
> diff -r fff6b54e9770 make/aix/makefiles/vm.make
> --- a/make/aix/makefiles/vm.make Thu Jul 16 19:28:37 2015 -0700
> +++ b/make/aix/makefiles/vm.make Tue Jul 21 08:55:08 2015 -0700
> @@ -112,6 +112,7 @@
> # Extra flags from gnumake's invocation or environment
> CFLAGS += $(EXTRA_CFLAGS)
> LFLAGS += $(EXTRA_CFLAGS)
> +CXXFLAGS += $(EXTRA_CXXFLAGS)
>
> # Don't set excutable bit on stack segment
> # the same could be done by separate execstack command
> diff -r fff6b54e9770 make/bsd/makefiles/vm.make
> --- a/make/bsd/makefiles/vm.make Thu Jul 16 19:28:37 2015 -0700
> +++ b/make/bsd/makefiles/vm.make Tue Jul 21 08:55:08 2015 -0700
> @@ -114,6 +114,7 @@
> # Extra flags from gnumake's invocation or environment
> CFLAGS += $(EXTRA_CFLAGS)
> LFLAGS += $(EXTRA_CFLAGS)
> +CXXFLAGS += $(EXTRA_CXXFLAGS)
>
> # Don't set excutable bit on stack segment
> # the same could be done by separate execstack command
> diff -r fff6b54e9770 make/linux/makefiles/vm.make
> --- a/make/linux/makefiles/vm.make Thu Jul 16 19:28:37 2015 -0700
> +++ b/make/linux/makefiles/vm.make Tue Jul 21 08:55:08 2015 -0700
> @@ -117,6 +117,7 @@
> # Extra flags from gnumake's invocation or environment
> CFLAGS += $(EXTRA_CFLAGS)
> LFLAGS += $(EXTRA_CFLAGS)
> +CXXFLAGS += $(EXTRA_CXXFLAGS)
>
> # Don't set excutable bit on stack segment
> # the same could be done by separate execstack command
> diff -r fff6b54e9770 make/solaris/makefiles/vm.make
> --- a/make/solaris/makefiles/vm.make Thu Jul 16 19:28:37 2015 -0700
> +++ b/make/solaris/makefiles/vm.make Tue Jul 21 08:55:08 2015 -0700
> @@ -110,6 +110,7 @@
>
> # Extra flags from gnumake's invocation or environment
> CFLAGS += $(EXTRA_CFLAGS)
> +CXXFLAGS += $(EXTRA_CXXFLAGS)
>
> # Math Library (libm.so), do not use -lm.
> # There might be two versions of libm.so on the build system:
>
More information about the build-dev
mailing list