Hello Matthias,
AFAIK, the only reason we support GCC versions older than 4.9 is for you
guys at SAP, so if you would suggest dropping support, that would of
course be the simplest solution.
If you want to keep support but make the use of this flag optional, the
preferred method is to add a test in flags.m4. We have macros defined
for this. FLAGS_COMPILER_CHECK_ARGUMENTS or
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS would be suitable in this case. Use
it to check if the flag is valid for the current compiler. If so, you
can define a variable
"CXXFLAGS_GCC_NO_VAR_TRACKING_ASSIGNMENTS=-fno-var-tracking-assignment"
and empty otherwise, and in the makefile use this variable in the
assignement.
We want to avoid static shell expressions in the makefiles if possible
and keep that kind of logic in configure. It's also better to explicitly
check for features rather than versions.
/Erik
On 2017-07-13 11:21, Baesken, Matthias wrote:
Hello, when building jdk10 on Suse Linux 11 with default gcc/g++ 4.3.4
installed, I was running into
compilation errors because of the missing support for g++ flag
-fno-var-tracking-assignments .
It seems gcc-4.6 has the -fvar-tracking-assignments /
-fnovar-tracking-assignments flags , see
https://gcc.gnu.org/onlinedocs/gcc-4.6.4/gcc/Option-Summary.html#Option-Summary
I have no gcc-4.6 at hand but could verify that gcc-4.7 and gcc-4.8 "know" the
flag.
There are various solutions one could do to avoid the compilation error .
1) disallow usage of old gcc versions here :
autoconf/toolchain.m4
TOOLCHAIN_MINIMUM_VERSION_gcc="4.3"
( e.g. change to minimum gcc 4.6 or gcc 4.7 supporting the flags used in
the build )
2) remove the flag -fno-var-tracking-assignments for older gcc versions here :
(in a similar way it was done :
http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/37e693211deb )
hotspot/make/lib/JvmOverrideFiles.gmk-32-ifeq ($(TOOLCHAIN_TYPE), gcc)
hotspot/make/lib/JvmOverrideFiles.gmk:33: BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS
:= -fno-var-tracking-assignments -O0
hotspot/make/lib/JvmOverrideFiles.gmk:34:
BUILD_LIBJVM_jvmciCompilerToVM.cpp_CXXFLAGS := -fno-var-tracking-assignments
hotspot/make/lib/JvmOverrideFiles.gmk-35-endif
What is your preferred solution ?
Thanks, Matthias