8238281: Raise minimum gcc version needed to 5.0

Reviewed-by: erikj, dholmes, jwilhelm, mbaesken
This commit is contained in:
Magnus Ihse Bursie 2020-02-05 10:45:39 +01:00
parent d6aeda7b24
commit ce28a96c28
12 changed files with 21 additions and 70 deletions

View File

@ -301,7 +301,7 @@
</table> </table>
<p>All compilers are expected to be able to compile to the C99 language standard, as some C99 features are used in the source code. Microsoft Visual Studio doesn't fully support C99 so in practice shared code is limited to using C99 features that it does support.</p> <p>All compilers are expected to be able to compile to the C99 language standard, as some C99 features are used in the source code. Microsoft Visual Studio doesn't fully support C99 so in practice shared code is limited to using C99 features that it does support.</p>
<h3 id="gcc">gcc</h3> <h3 id="gcc">gcc</h3>
<p>The minimum accepted version of gcc is 4.8. Older versions will generate a warning by <code>configure</code> and are unlikely to work.</p> <p>The minimum accepted version of gcc is 5.0. Older versions will generate a warning by <code>configure</code> and are unlikely to work.</p>
<p>The JDK is currently known to be able to compile with at least version 8.3 of gcc.</p> <p>The JDK is currently known to be able to compile with at least version 8.3 of gcc.</p>
<p>In general, any version between these two should be usable.</p> <p>In general, any version between these two should be usable.</p>
<h3 id="clang">clang</h3> <h3 id="clang">clang</h3>
@ -639,11 +639,6 @@ x86_64-linux-gnu-to-ppc64le-linux-gnu</code></pre>
<p>You will need two copies of your toolchain, one which generates output that can run on the target system (the normal, or <em>target</em>, toolchain), and one that generates output that can run on the build system (the <em>build</em> toolchain). Note that cross-compiling is only supported for gcc at the time being. The gcc standard is to prefix cross-compiling toolchains with the target denominator. If you follow this standard, <code>configure</code> is likely to pick up the toolchain correctly.</p> <p>You will need two copies of your toolchain, one which generates output that can run on the target system (the normal, or <em>target</em>, toolchain), and one that generates output that can run on the build system (the <em>build</em> toolchain). Note that cross-compiling is only supported for gcc at the time being. The gcc standard is to prefix cross-compiling toolchains with the target denominator. If you follow this standard, <code>configure</code> is likely to pick up the toolchain correctly.</p>
<p>The <em>build</em> toolchain will be autodetected just the same way the normal <em>build</em>/<em>target</em> toolchain will be autodetected when not cross-compiling. If this is not what you want, or if the autodetection fails, you can specify a devkit containing the <em>build</em> toolchain using <code>--with-build-devkit</code> to <code>configure</code>, or by giving <code>BUILD_CC</code> and <code>BUILD_CXX</code> arguments.</p> <p>The <em>build</em> toolchain will be autodetected just the same way the normal <em>build</em>/<em>target</em> toolchain will be autodetected when not cross-compiling. If this is not what you want, or if the autodetection fails, you can specify a devkit containing the <em>build</em> toolchain using <code>--with-build-devkit</code> to <code>configure</code>, or by giving <code>BUILD_CC</code> and <code>BUILD_CXX</code> arguments.</p>
<p>It is often helpful to locate the cross-compilation tools, headers and libraries in a separate directory, outside the normal path, and point out that directory to <code>configure</code>. Do this by setting the sysroot (<code>--with-sysroot</code>) and appending the directory when searching for cross-compilations tools (<code>--with-toolchain-path</code>). As a compact form, you can also use <code>--with-devkit</code> to point to a single directory, if it is correctly setup. (See <code>basics.m4</code> for details.)</p> <p>It is often helpful to locate the cross-compilation tools, headers and libraries in a separate directory, outside the normal path, and point out that directory to <code>configure</code>. Do this by setting the sysroot (<code>--with-sysroot</code>) and appending the directory when searching for cross-compilations tools (<code>--with-toolchain-path</code>). As a compact form, you can also use <code>--with-devkit</code> to point to a single directory, if it is correctly setup. (See <code>basics.m4</code> for details.)</p>
<p>If you are unsure what toolchain and versions to use, these have been proved working at the time of writing:</p>
<ul>
<li><a href="https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux.tar.xz">aarch64</a></li>
<li><a href="https://launchpad.net/linaro-toolchain-unsupported/trunk/2012.09/+download/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tar.bz2">arm 32-bit hardware floating point</a></li>
</ul>
<h3 id="native-libraries">Native Libraries</h3> <h3 id="native-libraries">Native Libraries</h3>
<p>You will need copies of external native libraries for the <em>target</em> system, present on the <em>build</em> machine while building.</p> <p>You will need copies of external native libraries for the <em>target</em> system, present on the <em>build</em> machine while building.</p>
<p>Take care not to replace the <em>build</em> system's version of these libraries by mistake, since that can render the <em>build</em> machine unusable.</p> <p>Take care not to replace the <em>build</em> system's version of these libraries by mistake, since that can render the <em>build</em> machine unusable.</p>

View File

@ -339,7 +339,7 @@ features that it does support.
### gcc ### gcc
The minimum accepted version of gcc is 4.8. Older versions will generate a warning The minimum accepted version of gcc is 5.0. Older versions will generate a warning
by `configure` and are unlikely to work. by `configure` and are unlikely to work.
The JDK is currently known to be able to compile with at least version 8.3 of The JDK is currently known to be able to compile with at least version 8.3 of
@ -1038,14 +1038,6 @@ appending the directory when searching for cross-compilations tools
to point to a single directory, if it is correctly setup. (See `basics.m4` for to point to a single directory, if it is correctly setup. (See `basics.m4` for
details.) details.)
If you are unsure what toolchain and versions to use, these have been proved
working at the time of writing:
* [aarch64](
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux.tar.xz)
* [arm 32-bit hardware floating point](
https://launchpad.net/linaro-toolchain-unsupported/trunk/2012.09/+download/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tar.bz2)
### Native Libraries ### Native Libraries
You will need copies of external native libraries for the *target* system, You will need copies of external native libraries for the *target* system,

View File

@ -598,8 +598,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# our toolchains are in a condition to support that. But what we loosely aim for is # our toolchains are in a condition to support that. But what we loosely aim for is
# C99 level. # C99 level.
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
# This raises the language level for older 4.8 gcc, while lowering it for later # Explicitly set C99. clang and xlclang support the same flag.
# versions. clang and xlclang support the same flag.
LANGSTD_CFLAGS="-std=c99" LANGSTD_CFLAGS="-std=c99"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
# We can't turn on -std=c99 without breaking compilation of the splashscreen/png # We can't turn on -std=c99 without breaking compilation of the splashscreen/png

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ AC_DEFUN([FLAGS_SETUP_ABI_PROFILE],
# --- Arm-sflt CFLAGS and ASFLAGS --- # --- Arm-sflt CFLAGS and ASFLAGS ---
# Armv5te is required for assembler, because pld insn used in arm32 hotspot is only in v5E and above. # Armv5te is required for assembler, because pld insn used in arm32 hotspot is only in v5E and above.
# However, there is also a GCC bug which generates unaligned strd/ldrd instructions on armv5te: # However, there is also a GCC bug which generates unaligned strd/ldrd instructions on armv5te:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82445, and it was fixed only quite recently. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82445, and it was fixed in gcc 7.1.
# The resulting compromise is to enable v5TE for assembler and let GCC generate code for v5T. # The resulting compromise is to enable v5TE for assembler and let GCC generate code for v5T.
if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
ARM_FLOAT_TYPE=vfp-sflt ARM_FLOAT_TYPE=vfp-sflt

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
# Minimum supported versions, empty means unspecified # Minimum supported versions, empty means unspecified
TOOLCHAIN_MINIMUM_VERSION_clang="3.2" TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
TOOLCHAIN_MINIMUM_VERSION_gcc="4.8" TOOLCHAIN_MINIMUM_VERSION_gcc="5.0"
TOOLCHAIN_MINIMUM_VERSION_microsoft="16.00.30319.01" # VS2010 TOOLCHAIN_MINIMUM_VERSION_microsoft="16.00.30319.01" # VS2010
TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13" TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13"
TOOLCHAIN_MINIMUM_VERSION_xlc="" TOOLCHAIN_MINIMUM_VERSION_xlc=""

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -82,7 +82,7 @@ DISABLED_WARNINGS_gcc := parentheses comment unknown-pragmas address \
delete-non-virtual-dtor char-subscripts array-bounds int-in-bool-context \ delete-non-virtual-dtor char-subscripts array-bounds int-in-bool-context \
ignored-qualifiers missing-field-initializers implicit-fallthrough \ ignored-qualifiers missing-field-initializers implicit-fallthrough \
empty-body strict-overflow sequence-point maybe-uninitialized \ empty-body strict-overflow sequence-point maybe-uninitialized \
misleading-indentation cast-function-type misleading-indentation cast-function-type invalid-offsetof
ifeq ($(call check-jvm-feature, zero), true) ifeq ($(call check-jvm-feature, zero), true)
DISABLED_WARNINGS_gcc += return-type switch clobbered DISABLED_WARNINGS_gcc += return-type switch clobbered
@ -91,7 +91,8 @@ endif
DISABLED_WARNINGS_clang := tautological-compare \ DISABLED_WARNINGS_clang := tautological-compare \
undefined-var-template sometimes-uninitialized unknown-pragmas \ undefined-var-template sometimes-uninitialized unknown-pragmas \
delete-non-virtual-dtor missing-braces char-subscripts \ delete-non-virtual-dtor missing-braces char-subscripts \
ignored-qualifiers missing-field-initializers mismatched-tags ignored-qualifiers missing-field-initializers mismatched-tags \
invalid-offsetof
DISABLED_WARNINGS_solstudio := labelnotused hidef w_novirtualdescr inlafteruse \ DISABLED_WARNINGS_solstudio := labelnotused hidef w_novirtualdescr inlafteruse \
unknownpragma doubunder w_enumnotused w_toomanyenumnotused \ unknownpragma doubunder w_enumnotused w_toomanyenumnotused \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -91,9 +91,7 @@ void operator delete [](void* p) throw() {
#ifdef __GNUG__ #ifdef __GNUG__
// Warning disabled for gcc 5.4 // Warning disabled for gcc 5.4
// Warning for unknown warning disabled for gcc 4.8.5
PRAGMA_DIAG_PUSH PRAGMA_DIAG_PUSH
PRAGMA_DISABLE_GCC_WARNING("-Wpragmas")
PRAGMA_DISABLE_GCC_WARNING("-Wc++14-compat") PRAGMA_DISABLE_GCC_WARNING("-Wc++14-compat")
#endif // __GNUG__ #endif // __GNUG__

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -2783,7 +2783,7 @@ void jio_print(const char* s, size_t len) {
if (Arguments::vfprintf_hook() != NULL) { if (Arguments::vfprintf_hook() != NULL) {
jio_fprintf(defaultStream::output_stream(), "%.*s", (int)len, s); jio_fprintf(defaultStream::output_stream(), "%.*s", (int)len, s);
} else { } else {
// Make an unused local variable to avoid warning from gcc 4.x compiler. // Make an unused local variable to avoid warning from gcc compiler.
size_t count = ::write(defaultStream::output_fd(), s, (int)len); size_t count = ::write(defaultStream::output_fd(), s, (int)len);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,18 +27,12 @@
// Macros related to control of compiler warnings. // Macros related to control of compiler warnings.
// Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
// were only introduced in GCC 4.2. Because we have no other possibility to ignore
// these warnings for older versions of GCC, we simply don't decorate our printf-style
// functions with __attribute__(format) in that case.
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)
#ifndef ATTRIBUTE_PRINTF #ifndef ATTRIBUTE_PRINTF
#define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs))) #define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs)))
#endif #endif
#ifndef ATTRIBUTE_SCANF #ifndef ATTRIBUTE_SCANF
#define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs))) #define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs)))
#endif #endif
#endif // gcc version check
#define PRAGMA_DISABLE_GCC_WARNING_AUX(x) _Pragma(#x) #define PRAGMA_DISABLE_GCC_WARNING_AUX(x) _Pragma(#x)
#define PRAGMA_DISABLE_GCC_WARNING(option_string) \ #define PRAGMA_DISABLE_GCC_WARNING(option_string) \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -154,15 +154,8 @@ enum VMErrorType {
// error reporting helper functions // error reporting helper functions
void report_vm_error(const char* file, int line, const char* error_msg); void report_vm_error(const char* file, int line, const char* error_msg);
#if !defined(__GNUC__) || defined (__clang_major__) || (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || __GNUC__ > 4)
// ATTRIBUTE_PRINTF works with gcc >= 4.8 and any other compiler.
void report_vm_error(const char* file, int line, const char* error_msg, void report_vm_error(const char* file, int line, const char* error_msg,
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5); const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
#else
// GCC < 4.8 warns because of empty format string. Warning can not be switched off selectively.
void report_vm_error(const char* file, int line, const char* error_msg,
const char* detail_fmt, ...);
#endif
void report_vm_status_error(const char* file, int line, const char* error_msg, void report_vm_status_error(const char* file, int line, const char* error_msg,
int status, const char* detail); int status, const char* detail);
void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4); void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -210,10 +210,7 @@ inline int g_isnan(double f) { return isnan(f); }
#error "missing platform-specific definition here" #error "missing platform-specific definition here"
#endif #endif
// GCC 4.3 does not allow 0.0/0.0 to produce a NAN value
#if (__GNUC__ == 4) && (__GNUC_MINOR__ > 2)
#define CAN_USE_NAN_DEFINE 1 #define CAN_USE_NAN_DEFINE 1
#endif
// Checking for finiteness // Checking for finiteness
@ -238,16 +235,7 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
#define FORMAT64_MODIFIER "ll" #define FORMAT64_MODIFIER "ll"
#endif // _LP64 #endif // _LP64
// HACK: gcc warns about applying offsetof() to non-POD object or calculating #define offset_of(klass,field) offsetof(klass,field)
// offset directly when base address is NULL. Use 16 to get around the
// warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress
// this warning.
#define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
#ifdef offsetof
# undef offsetof
#endif
#define offsetof(klass,field) offset_of(klass,field)
#if defined(_LP64) && defined(__APPLE__) #if defined(_LP64) && defined(__APPLE__)
#define JLONG_FORMAT "%ld" #define JLONG_FORMAT "%ld"
@ -262,15 +250,6 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
// Alignment // Alignment
// //
// NOTE! The "+0" below is a workaround for a known bug in older GCC versions #define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))
// (known to fail with 4.6.0, fixed in 4.9.0). This bug affects systems such as
// RedHat/Oracle Linux 7.5, which ships with GCC 4.8.5. For more details, see
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382 and
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53017
//
// GCC versions older than 4.6.4 would fail even with "+0", and needs additional
// cast to __typeof__(x) to work around the similar bug.
//
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned((__typeof__(x))x+0)))
#endif // SHARE_UTILITIES_GLOBALDEFINITIONS_GCC_HPP #endif // SHARE_UTILITIES_GLOBALDEFINITIONS_GCC_HPP

View File

@ -531,7 +531,7 @@ fileStream::fileStream(const char* file_name, const char* opentype) {
void fileStream::write(const char* s, size_t len) { void fileStream::write(const char* s, size_t len) {
if (_file != NULL) { if (_file != NULL) {
// Make an unused local variable to avoid warning from gcc 4.x compiler. // Make an unused local variable to avoid warning from gcc compiler.
size_t count = fwrite(s, 1, len, _file); size_t count = fwrite(s, 1, len, _file);
} }
update_position(s, len); update_position(s, len);
@ -570,7 +570,7 @@ void fileStream::flush() {
void fdStream::write(const char* s, size_t len) { void fdStream::write(const char* s, size_t len) {
if (_fd != -1) { if (_fd != -1) {
// Make an unused local variable to avoid warning from gcc 4.x compiler. // Make an unused local variable to avoid warning from gcc compiler.
size_t count = ::write(_fd, s, (int)len); size_t count = ::write(_fd, s, (int)len);
} }
update_position(s, len); update_position(s, len);