Skip to content

Commit ce28a96

Browse files
committed
8238281: Raise minimum gcc version needed to 5.0
Reviewed-by: erikj, dholmes, jwilhelm, mbaesken
1 parent d6aeda7 commit ce28a96

File tree

12 files changed

+21
-70
lines changed

12 files changed

+21
-70
lines changed

doc/building.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ <h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requ
301301
</table>
302302
<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>
303303
<h3 id="gcc">gcc</h3>
304-
<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>
304+
<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>
305305
<p>The JDK is currently known to be able to compile with at least version 8.3 of gcc.</p>
306306
<p>In general, any version between these two should be usable.</p>
307307
<h3 id="clang">clang</h3>
@@ -639,11 +639,6 @@ <h3 id="toolchain-considerations">Toolchain Considerations</h3>
639639
<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>
640640
<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>
641641
<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>
642-
<p>If you are unsure what toolchain and versions to use, these have been proved working at the time of writing:</p>
643-
<ul>
644-
<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>
645-
<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>
646-
</ul>
647642
<h3 id="native-libraries">Native Libraries</h3>
648643
<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>
649644
<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>

doc/building.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ features that it does support.
339339

340340
### gcc
341341

342-
The minimum accepted version of gcc is 4.8. Older versions will generate a warning
342+
The minimum accepted version of gcc is 5.0. Older versions will generate a warning
343343
by `configure` and are unlikely to work.
344344

345345
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
10381038
to point to a single directory, if it is correctly setup. (See `basics.m4` for
10391039
details.)
10401040
1041-
If you are unsure what toolchain and versions to use, these have been proved
1042-
working at the time of writing:
1043-
1044-
* [aarch64](
1045-
https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux.tar.xz)
1046-
* [arm 32-bit hardware floating point](
1047-
https://launchpad.net/linaro-toolchain-unsupported/trunk/2012.09/+download/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tar.bz2)
1048-
10491041
### Native Libraries
10501042
10511043
You will need copies of external native libraries for the *target* system,

make/autoconf/flags-cflags.m4

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
598598
# our toolchains are in a condition to support that. But what we loosely aim for is
599599
# C99 level.
600600
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
601-
# This raises the language level for older 4.8 gcc, while lowering it for later
602-
# versions. clang and xlclang support the same flag.
601+
# Explicitly set C99. clang and xlclang support the same flag.
603602
LANGSTD_CFLAGS="-std=c99"
604603
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
605604
# We can't turn on -std=c99 without breaking compilation of the splashscreen/png

make/autoconf/flags.m4

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

make/autoconf/toolchain.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
5252

5353
# Minimum supported versions, empty means unspecified
5454
TOOLCHAIN_MINIMUM_VERSION_clang="3.2"
55-
TOOLCHAIN_MINIMUM_VERSION_gcc="4.8"
55+
TOOLCHAIN_MINIMUM_VERSION_gcc="5.0"
5656
TOOLCHAIN_MINIMUM_VERSION_microsoft="16.00.30319.01" # VS2010
5757
TOOLCHAIN_MINIMUM_VERSION_solstudio="5.13"
5858
TOOLCHAIN_MINIMUM_VERSION_xlc=""

make/hotspot/lib/CompileJvm.gmk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# 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 \
8282
delete-non-virtual-dtor char-subscripts array-bounds int-in-bool-context \
8383
ignored-qualifiers missing-field-initializers implicit-fallthrough \
8484
empty-body strict-overflow sequence-point maybe-uninitialized \
85-
misleading-indentation cast-function-type
85+
misleading-indentation cast-function-type invalid-offsetof
8686

8787
ifeq ($(call check-jvm-feature, zero), true)
8888
DISABLED_WARNINGS_gcc += return-type switch clobbered
@@ -91,7 +91,8 @@ endif
9191
DISABLED_WARNINGS_clang := tautological-compare \
9292
undefined-var-template sometimes-uninitialized unknown-pragmas \
9393
delete-non-virtual-dtor missing-braces char-subscripts \
94-
ignored-qualifiers missing-field-initializers mismatched-tags
94+
ignored-qualifiers missing-field-initializers mismatched-tags \
95+
invalid-offsetof
9596

9697
DISABLED_WARNINGS_solstudio := labelnotused hidef w_novirtualdescr inlafteruse \
9798
unknownpragma doubunder w_enumnotused w_toomanyenumnotused \

src/hotspot/share/memory/operator_new.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -91,9 +91,7 @@ void operator delete [](void* p) throw() {
9191

9292
#ifdef __GNUG__
9393
// Warning disabled for gcc 5.4
94-
// Warning for unknown warning disabled for gcc 4.8.5
9594
PRAGMA_DIAG_PUSH
96-
PRAGMA_DISABLE_GCC_WARNING("-Wpragmas")
9795
PRAGMA_DISABLE_GCC_WARNING("-Wc++14-compat")
9896
#endif // __GNUG__
9997

src/hotspot/share/prims/jvm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* 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) {
27832783
if (Arguments::vfprintf_hook() != NULL) {
27842784
jio_fprintf(defaultStream::output_stream(), "%.*s", (int)len, s);
27852785
} else {
2786-
// Make an unused local variable to avoid warning from gcc 4.x compiler.
2786+
// Make an unused local variable to avoid warning from gcc compiler.
27872787
size_t count = ::write(defaultStream::output_fd(), s, (int)len);
27882788
}
27892789
}

src/hotspot/share/utilities/compilerWarnings_gcc.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,18 +27,12 @@
2727

2828
// Macros related to control of compiler warnings.
2929

30-
// Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
31-
// were only introduced in GCC 4.2. Because we have no other possibility to ignore
32-
// these warnings for older versions of GCC, we simply don't decorate our printf-style
33-
// functions with __attribute__(format) in that case.
34-
#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)
3530
#ifndef ATTRIBUTE_PRINTF
3631
#define ATTRIBUTE_PRINTF(fmt,vargs) __attribute__((format(printf, fmt, vargs)))
3732
#endif
3833
#ifndef ATTRIBUTE_SCANF
3934
#define ATTRIBUTE_SCANF(fmt,vargs) __attribute__((format(scanf, fmt, vargs)))
4035
#endif
41-
#endif // gcc version check
4236

4337
#define PRAGMA_DISABLE_GCC_WARNING_AUX(x) _Pragma(#x)
4438
#define PRAGMA_DISABLE_GCC_WARNING(option_string) \

src/hotspot/share/utilities/debug.hpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -154,15 +154,8 @@ enum VMErrorType {
154154

155155
// error reporting helper functions
156156
void report_vm_error(const char* file, int line, const char* error_msg);
157-
#if !defined(__GNUC__) || defined (__clang_major__) || (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || __GNUC__ > 4)
158-
// ATTRIBUTE_PRINTF works with gcc >= 4.8 and any other compiler.
159157
void report_vm_error(const char* file, int line, const char* error_msg,
160158
const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
161-
#else
162-
// GCC < 4.8 warns because of empty format string. Warning can not be switched off selectively.
163-
void report_vm_error(const char* file, int line, const char* error_msg,
164-
const char* detail_fmt, ...);
165-
#endif
166159
void report_vm_status_error(const char* file, int line, const char* error_msg,
167160
int status, const char* detail);
168161
void report_fatal(const char* file, int line, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(3, 4);

src/hotspot/share/utilities/globalDefinitions_gcc.hpp

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* 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); }
210210
#error "missing platform-specific definition here"
211211
#endif
212212

213-
// GCC 4.3 does not allow 0.0/0.0 to produce a NAN value
214-
#if (__GNUC__ == 4) && (__GNUC_MINOR__ > 2)
215213
#define CAN_USE_NAN_DEFINE 1
216-
#endif
217214

218215

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

241-
// HACK: gcc warns about applying offsetof() to non-POD object or calculating
242-
// offset directly when base address is NULL. Use 16 to get around the
243-
// warning. gcc-3.4 has an option -Wno-invalid-offsetof to suppress
244-
// this warning.
245-
#define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
246-
247-
#ifdef offsetof
248-
# undef offsetof
249-
#endif
250-
#define offsetof(klass,field) offset_of(klass,field)
238+
#define offset_of(klass,field) offsetof(klass,field)
251239

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

263251
// Alignment
264252
//
265-
// NOTE! The "+0" below is a workaround for a known bug in older GCC versions
266-
// (known to fail with 4.6.0, fixed in 4.9.0). This bug affects systems such as
267-
// RedHat/Oracle Linux 7.5, which ships with GCC 4.8.5. For more details, see
268-
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55382 and
269-
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53017
270-
//
271-
// GCC versions older than 4.6.4 would fail even with "+0", and needs additional
272-
// cast to __typeof__(x) to work around the similar bug.
273-
//
274-
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned((__typeof__(x))x+0)))
253+
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))
275254

276255
#endif // SHARE_UTILITIES_GLOBALDEFINITIONS_GCC_HPP

src/hotspot/share/utilities/ostream.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ fileStream::fileStream(const char* file_name, const char* opentype) {
531531

532532
void fileStream::write(const char* s, size_t len) {
533533
if (_file != NULL) {
534-
// Make an unused local variable to avoid warning from gcc 4.x compiler.
534+
// Make an unused local variable to avoid warning from gcc compiler.
535535
size_t count = fwrite(s, 1, len, _file);
536536
}
537537
update_position(s, len);
@@ -570,7 +570,7 @@ void fileStream::flush() {
570570

571571
void fdStream::write(const char* s, size_t len) {
572572
if (_fd != -1) {
573-
// Make an unused local variable to avoid warning from gcc 4.x compiler.
573+
// Make an unused local variable to avoid warning from gcc compiler.
574574
size_t count = ::write(_fd, s, (int)len);
575575
}
576576
update_position(s, len);

0 commit comments

Comments
 (0)