RFR: 8151841: Build needs additional flags to compile with GCC 6
gnu.andrew at redhat.com
Mon Mar 14 19:17:54 UTC 2016
A number of additional flags need to be passed to the C and C++ compiler
for OpenJDK to compile with GCC 6:
1. The C++ standard needs to be explicitly lowered to the old default of
gnu++98. With the new GCC default of C++14, the build fails, due to the way
C++ is used in HotSpot and the JDK native code. Long term, it might be good
to fix the code itself, in OpenJDK 9 or 10, but we need an interim solution
to make OpenJDK buildable and one we can backport to existing supported
version (6, 7 and 8).
2. A number of optimisations in GCC 6 lead to a broken JVM. We need to add
-fno-delete-null-pointer-checks and -fno-lifetime-dse to get a working JVM.
The webrev adds checks for these flags to configure and adds them if they
are supported by GCC. It was necessary to split the macro
FLAGS_COMPILER_CHECK_ARGUMENTS into FLAGS_C_COMPILER_CHECK_ARGUMENTS
and FLAGS_CXX_COMPILER_CHECK_ARGUMENTS as the -std=g++98 argument
is only applicable to the C++ compiler and will fail with the C compiler.
With just the original macro, this would have meant that the argument
never passed the test.
I've built this locally on hs-rt/amd64 with GCC 5.3 successfully and I've
also built a backport to 8u (nearly the same, but adjusted for macro placement
and structural changes in 8u) on x86, amd64 and armv7hl with GCC 6 (Fedora rawhide) .
If this looks ok, let me know which tree to push it to; I'm not sure if
it should go in as a general build change or a HotSpot change.
Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)
PGP Key: ed25519/35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
More information about the build-dev