Skip to content

Commit 2a8f92e

Browse files
author
Kim Barrett
committed
8246032: Implementation of JEP 347: Enable C++14 Language Features
Update build configuration to use C++14 Reviewed-by: jlaskey, mdoerr, ihse, erikj
1 parent dff37f8 commit 2a8f92e

File tree

10 files changed

+33
-80
lines changed

10 files changed

+33
-80
lines changed

doc/building.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ <h3 id="gcc">gcc</h3>
283283
<p>The JDK is currently known to be able to compile with at least version 9.2 of gcc.</p>
284284
<p>In general, any version between these two should be usable.</p>
285285
<h3 id="clang">clang</h3>
286-
<p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
286+
<p>The minimum accepted version of clang is 3.5. Older versions will not be accepted by <code>configure</code>.</p>
287287
<p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
288288
<h3 id="apple-xcode">Apple Xcode</h3>
289289
<p>The oldest supported version of Xcode is 8.</p>
@@ -292,9 +292,8 @@ <h3 id="apple-xcode">Apple Xcode</h3>
292292
<p>It is advisable to keep an older version of Xcode for building the JDK when updating Xcode. This <a href="http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html">blog page</a> has good suggestions on managing multiple Xcode versions. To use a specific version of Xcode, use <code>xcode-select -s</code> before running <code>configure</code>, or use <code>--with-toolchain-path</code> to point to the version of Xcode to use, e.g. <code>configure --with-toolchain-path=/Applications/Xcode8.app/Contents/Developer/usr/bin</code></p>
293293
<p>If you have recently (inadvertently) updated your OS and/or Xcode version, and the JDK can no longer be built, please see the section on <a href="#problems-with-the-build-environment">Problems with the Build Environment</a>, and <a href="#getting-help">Getting Help</a> to find out if there are any recent, non-merged patches available for this update.</p>
294294
<h3 id="microsoft-visual-studio">Microsoft Visual Studio</h3>
295-
<p>The minimum accepted version of Visual Studio is 2010. Older versions will not be accepted by <code>configure</code>. The maximum accepted version of Visual Studio is 2019. Versions older than 2017 are unlikely to continue working for long.</p>
296-
<p>If you have multiple versions of Visual Studio installed, <code>configure</code> will by default pick the latest. You can request a specific version to be used by setting <code>--with-toolchain-version</code>, e.g. <code>--with-toolchain-version=2015</code>.</p>
297-
<p>If you get <code>LINK: fatal error LNK1123: failure during conversion to COFF: file invalid</code> when building using Visual Studio 2010, you have encountered <a href="http://support.microsoft.com/kb/2757355">KB2757355</a>, a bug triggered by a specific installation order. However, the solution suggested by the KB article does not always resolve the problem. See <a href="https://stackoverflow.com/questions/10888391">this stackoverflow discussion</a> for other suggestions.</p>
295+
<p>The minimum accepted version of Visual Studio is 2017. Older versions will not be accepted by <code>configure</code> and will not work. The maximum accepted version of Visual Studio is 2019.</p>
296+
<p>If you have multiple versions of Visual Studio installed, <code>configure</code> will by default pick the latest. You can request a specific version to be used by setting <code>--with-toolchain-version</code>, e.g. <code>--with-toolchain-version=2017</code>.</p>
298297
<h3 id="ibm-xl-cc">IBM XL C/C++</h3>
299298
<p>Please consult the AIX section of the <a href="https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms">Supported Build Platforms</a> OpenJDK Build Wiki page for details about which versions of XLC are supported.</p>
300299
<h2 id="boot-jdk-requirements">Boot JDK Requirements</h2>

doc/building.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ In general, any version between these two should be usable.
323323

324324
### clang
325325

326-
The minimum accepted version of clang is 3.2. Older versions will not be
326+
The minimum accepted version of clang is 3.5. Older versions will not be
327327
accepted by `configure`.
328328

329329
To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`.
@@ -355,20 +355,13 @@ available for this update.
355355

356356
### Microsoft Visual Studio
357357

358-
The minimum accepted version of Visual Studio is 2010. Older versions will not
359-
be accepted by `configure`. The maximum accepted version of Visual Studio is
360-
2019. Versions older than 2017 are unlikely to continue working for long.
358+
The minimum accepted version of Visual Studio is 2017. Older versions will not
359+
be accepted by `configure` and will not work. The maximum accepted
360+
version of Visual Studio is 2019.
361361

362362
If you have multiple versions of Visual Studio installed, `configure` will by
363363
default pick the latest. You can request a specific version to be used by
364-
setting `--with-toolchain-version`, e.g. `--with-toolchain-version=2015`.
365-
366-
If you get `LINK: fatal error LNK1123: failure during conversion to COFF: file
367-
invalid` when building using Visual Studio 2010, you have encountered
368-
[KB2757355](http://support.microsoft.com/kb/2757355), a bug triggered by a
369-
specific installation order. However, the solution suggested by the KB article
370-
does not always resolve the problem. See [this stackoverflow discussion](
371-
https://stackoverflow.com/questions/10888391) for other suggestions.
364+
setting `--with-toolchain-version`, e.g. `--with-toolchain-version=2017`.
372365

373366
### IBM XL C/C++
374367

make/autoconf/flags-cflags.m4

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,18 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
512512
fi
513513
TOOLCHAIN_CFLAGS_JDK_CONLY="$LANGSTD_CFLAGS $TOOLCHAIN_CFLAGS_JDK_CONLY"
514514
515+
# CXXFLAGS C++ language level for all of JDK, including Hotspot.
516+
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
517+
LANGSTD_CXXFLAGS="-std=c++14"
518+
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
519+
LANGSTD_CXXFLAGS="-std:c++14"
520+
else
521+
AC_MSG_ERROR([Don't know how to enable C++14 for this toolchain])
522+
fi
523+
TOOLCHAIN_CFLAGS_JDK_CXXONLY="$TOOLCHAIN_CFLAGS_JDK_CXXONLY $LANGSTD_CXXFLAGS"
524+
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $LANGSTD_CXXFLAGS"
525+
ADLC_LANGSTD_CXXFLAGS="$LANGSTD_CXXFLAGS"
526+
515527
# CFLAGS WARNINGS STUFF
516528
# Set JVM_CFLAGS warning handling
517529
if test "x$TOOLCHAIN_TYPE" = xgcc; then
@@ -694,13 +706,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
694706
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
695707
fi
696708
697-
$1_CXXSTD_CXXFLAG="-std=gnu++98"
698-
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${$1_CXXSTD_CXXFLAG}],
699-
PREFIX: $3, IF_FALSE: [$1_CXXSTD_CXXFLAG=""])
700-
$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY="${$1_CXXSTD_CXXFLAG}"
701-
$1_TOOLCHAIN_CFLAGS_JVM="${$1_TOOLCHAIN_CFLAGS_JVM} ${$1_CXXSTD_CXXFLAG}"
702-
$2ADLC_CXXFLAG="${$1_CXXSTD_CXXFLAG}"
703-
704709
elif test "x$TOOLCHAIN_TYPE" = xclang; then
705710
if test "x$FLAGS_OS" = xlinux; then
706711
# ppc test not really needed for clang
@@ -795,7 +800,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
795800
AC_SUBST($2CFLAGS_JDKEXE)
796801
AC_SUBST($2CXXFLAGS_JDKLIB)
797802
AC_SUBST($2CXXFLAGS_JDKEXE)
798-
AC_SUBST($2ADLC_CXXFLAG)
803+
AC_SUBST($2ADLC_LANGSTD_CXXFLAGS)
799804
800805
COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off"
801806
# Check that the compiler supports -ffp-contract=off flag

make/autoconf/flags-ldflags.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS],
5353
5454
LDFLAGS_TESTEXE="${TARGET_LDFLAGS_JDK_LIBPATH}"
5555
AC_SUBST(LDFLAGS_TESTEXE)
56+
AC_SUBST(ADLC_LDFLAGS)
5657
])
5758

5859
################################################################################

make/autoconf/lib-std.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ AC_DEFUN_ONCE([LIB_SETUP_STD_LIBS],
7070
else
7171
LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
7272
JVM_LDFLAGS="$JVM_LDFLAGS $STATIC_STDCXX_FLAGS"
73+
ADLC_LDFLAGS="$ADLC_LDFLAGS $STATIC_STDCXX_FLAGS"
7374
# Ideally, we should test stdc++ for the BUILD toolchain separately. For now
7475
# just use the same setting as for the TARGET toolchain.
7576
OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS $STATIC_STDCXX_FLAGS"

make/autoconf/spec.gmk.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ DISABLED_WARNINGS_CXX := @DISABLED_WARNINGS_CXX@
476476
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
477477

478478
CFLAGS_CCACHE:=@CFLAGS_CCACHE@
479-
ADLC_CXXFLAG=@ADLC_CXXFLAG@
479+
ADLC_LANGSTD_CXXFLAGS=@ADLC_LANGSTD_CXXFLAGS@
480+
ADLC_LDFLAGS=@ADLC_LDFLAGS@
480481

481482
# Tools that potentially need to be cross compilation aware.
482483
CC:=@FIXPATH@ @CCACHE@ @ICECC@ @CC@

make/autoconf/toolchain.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ TOOLCHAIN_DESCRIPTION_microsoft="Microsoft Visual Studio"
5050
TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
5151

5252
# Minimum supported versions, empty means unspecified
53-
TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
53+
TOOLCHAIN_MINIMUM_VERSION_clang="3.5"
5454
TOOLCHAIN_MINIMUM_VERSION_gcc="5.0"
55-
TOOLCHAIN_MINIMUM_VERSION_microsoft="16.00.30319.01" # VS2010
55+
TOOLCHAIN_MINIMUM_VERSION_microsoft="19.10.0.0" # VS2017
5656
TOOLCHAIN_MINIMUM_VERSION_xlc=""
5757

5858
# Minimum supported linker versions, empty means unspecified

make/autoconf/toolchain_windows.m4

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -25,55 +25,7 @@
2525

2626
################################################################################
2727
# The order of these defines the priority by which we try to find them.
28-
VALID_VS_VERSIONS="2019 2017 2013 2015 2012 2010"
29-
30-
VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
31-
VS_VERSION_INTERNAL_2010=100
32-
VS_MSVCR_2010=msvcr100.dll
33-
# We don't use msvcp on Visual Studio 2010
34-
#VS_MSVCP_2010=msvcp100.dll
35-
VS_ENVVAR_2010="VS100COMNTOOLS"
36-
VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
37-
VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
38-
VS_VS_PLATFORM_NAME_2010="v100"
39-
VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
40-
VS_SUPPORTED_2010=false
41-
42-
VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
43-
VS_VERSION_INTERNAL_2012=110
44-
VS_MSVCR_2012=msvcr110.dll
45-
VS_MSVCP_2012=msvcp110.dll
46-
VS_ENVVAR_2012="VS110COMNTOOLS"
47-
VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
48-
VS_SDK_INSTALLDIR_2012=
49-
VS_VS_PLATFORM_NAME_2012="v110"
50-
VS_SDK_PLATFORM_NAME_2012=
51-
VS_SUPPORTED_2012=false
52-
53-
VS_DESCRIPTION_2013="Microsoft Visual Studio 2013"
54-
VS_VERSION_INTERNAL_2013=120
55-
VS_MSVCR_2013=msvcr120.dll
56-
VS_MSVCP_2013=msvcp120.dll
57-
VS_ENVVAR_2013="VS120COMNTOOLS"
58-
VS_VS_INSTALLDIR_2013="Microsoft Visual Studio 12.0"
59-
VS_SDK_INSTALLDIR_2013=
60-
VS_VS_PLATFORM_NAME_2013="v120"
61-
VS_SDK_PLATFORM_NAME_2013=
62-
VS_SUPPORTED_2013=false
63-
64-
VS_DESCRIPTION_2015="Microsoft Visual Studio 2015"
65-
VS_VERSION_INTERNAL_2015=140
66-
VS_MSVCR_2015=vcruntime140.dll
67-
VS_MSVCP_2015=msvcp140.dll
68-
VS_ENVVAR_2015="VS140COMNTOOLS"
69-
VS_VS_INSTALLDIR_2015="Microsoft Visual Studio 14.0"
70-
VS_SDK_INSTALLDIR_2015=
71-
VS_VS_PLATFORM_NAME_2015="v140"
72-
VS_SDK_PLATFORM_NAME_2015=
73-
# The vcvars of 2015 breaks if 2017 is also installed. Work around this by
74-
# explicitly specifying Windows Kit 8.1 to be used.
75-
VS_ENV_ARGS_2015="8.1"
76-
VS_SUPPORTED_2015=false
28+
VALID_VS_VERSIONS="2019 2017"
7729

7830
VS_DESCRIPTION_2017="Microsoft Visual Studio 2017"
7931
VS_VERSION_INTERNAL_2017=141

make/hotspot/gensrc/GensrcAdlc.gmk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ ifeq ($(call check-jvm-feature, compiler2), true)
3737
ifeq ($(call isBuildOs, linux), true)
3838
ADLC_CFLAGS := -fno-exceptions -DLINUX
3939
else ifeq ($(call isBuildOs, aix), true)
40-
ADLC_LDFLAGS := -q64
40+
ADLC_LDFLAGS += -q64
4141
ADLC_CFLAGS := -qnortti -qeh -q64 -DAIX
4242
else ifeq ($(call isBuildOs, windows), true)
43-
ADLC_LDFLAGS := -nologo
43+
ADLC_LDFLAGS += -nologo
4444
ADLC_CFLAGS := -nologo -EHsc
4545
# NOTE: The old build also have -D_CRT_SECURE_NO_DEPRECATE but it doesn't
4646
# seem needed any more.
4747
ADLC_CFLAGS_WARNINGS := -W3 -D_CRT_SECURE_NO_WARNINGS
4848
endif
4949

50-
# Set the C++ standard if supported
51-
ADLC_CFLAGS += $(ADLC_CXXFLAG)
50+
# Set the C++ standard
51+
ADLC_CFLAGS += $(ADLC_LANGSTD_CXXFLAG)
5252

5353
# NOTE: The old build didn't set -DASSERT for windows but it doesn't seem to
5454
# hurt.

make/modules/jdk.hotspot.agent/Lib.gmk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
6666
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_CFLAGS) $(SA_CXXFLAGS), \
6767
EXTRA_SRC := $(LIBSA_EXTRA_SRC), \
6868
LDFLAGS := $(LDFLAGS_JDKLIB), \
69+
LIBS := $(LIBCXX), \
6970
LIBS_linux := $(LIBDL), \
7071
LIBS_macosx := -framework Foundation -framework JavaNativeFoundation \
7172
-framework JavaRuntimeSupport -framework Security -framework CoreFoundation, \

0 commit comments

Comments
 (0)