Skip to content
Permalink
Browse files

8238281: Raise minimum gcc version needed to 5.0

Reviewed-by: erikj, dholmes, jwilhelm, mbaesken
  • Loading branch information
magicus committed Feb 5, 2020
1 parent d6aeda7 commit ce28a96c283c3110953f9bb1333e222c2d81bd22
@@ -301,7 +301,7 @@ <h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requ
</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>
<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>In general, any version between these two should be usable.</p>
<h3 id="clang">clang</h3>
@@ -639,11 +639,6 @@ <h3 id="toolchain-considerations">Toolchain Considerations</h3>
<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>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>
<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>
@@ -339,7 +339,7 @@ features that it does support.

### 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.

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
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

You will need copies of external native libraries for the *target* system,
@@ -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
# C99 level.
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
# versions. clang and xlclang support the same flag.
# Explicitly set C99. clang and xlclang support the same flag.
LANGSTD_CFLAGS="-std=c99"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
# We can't turn on -std=c99 without breaking compilation of the splashscreen/png
@@ -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.
#
# 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 ---
# 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:
# 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.
if test "x$OPENJDK_TARGET_ABI_PROFILE" = xarm-vfp-sflt; then
ARM_FLOAT_TYPE=vfp-sflt
@@ -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.
#
# 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
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_solstudio="5.13"
TOOLCHAIN_MINIMUM_VERSION_xlc=""
@@ -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.
#
# 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 \
ignored-qualifiers missing-field-initializers implicit-fallthrough \
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)
DISABLED_WARNINGS_gcc += return-type switch clobbered
@@ -91,7 +91,8 @@ endif
DISABLED_WARNINGS_clang := tautological-compare \
undefined-var-template sometimes-uninitialized unknown-pragmas \
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 \
unknownpragma doubunder w_enumnotused w_toomanyenumnotused \
@@ -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.
*
* 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__
// Warning disabled for gcc 5.4
// Warning for unknown warning disabled for gcc 4.8.5
PRAGMA_DIAG_PUSH
PRAGMA_DISABLE_GCC_WARNING("-Wpragmas")
PRAGMA_DISABLE_GCC_WARNING("-Wc++14-compat")
#endif // __GNUG__

@@ -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.
*
* 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) {
jio_fprintf(defaultStream::output_stream(), "%.*s", (int)len, s);
} 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);
}
}
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,18 +27,12 @@

// 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
#define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs)))
#endif
#ifndef ATTRIBUTE_SCANF
#define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs)))
#endif
#endif // gcc version check

#define PRAGMA_DISABLE_GCC_WARNING_AUX(x) _Pragma(#x)
#define PRAGMA_DISABLE_GCC_WARNING(option_string) \
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -154,15 +154,8 @@ enum VMErrorType {

// error reporting helper functions
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,
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,
int status, const char* detail);
void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);
@@ -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.
*
* 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"
#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
#endif


// Checking for finiteness
@@ -238,16 +235,7 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
#define FORMAT64_MODIFIER "ll"
#endif // _LP64

// HACK: gcc warns about applying offsetof() to non-POD object or calculating
// 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)
#define offset_of(klass,field) offsetof(klass,field)

#if defined(_LP64) && defined(__APPLE__)
#define JLONG_FORMAT "%ld"
@@ -262,15 +250,6 @@ inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }

// Alignment
//
// NOTE! The "+0" below is a workaround for a known bug in older GCC versions
// (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)))
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))

#endif // SHARE_UTILITIES_GLOBALDEFINITIONS_GCC_HPP
@@ -531,7 +531,7 @@ fileStream::fileStream(const char* file_name, const char* opentype) {

void fileStream::write(const char* s, size_t len) {
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);
}
update_position(s, len);
@@ -570,7 +570,7 @@ void fileStream::flush() {

void fdStream::write(const char* s, size_t len) {
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);
}
update_position(s, len);

0 comments on commit ce28a96

Please sign in to comment.