Skip to content

Commit b8ac68d

Browse files
committed
8220093: Change to GCC 8.2 for building on Linux at Oracle
Reviewed-by: mbaesken Backport-of: 290bfe5
1 parent 97809af commit b8ac68d

File tree

5 files changed

+100
-25
lines changed

5 files changed

+100
-25
lines changed

make/autoconf/toolchain.m4

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,14 +600,21 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
600600
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
601601
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
602602
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
603-
# gcc -Wl,-version output typically looks like
603+
# gcc -Wl,-version output typically looks like:
604604
# GNU ld (GNU Binutils for Ubuntu) 2.26.1
605605
# Copyright (C) 2015 Free Software Foundation, Inc.
606606
# This program is free software; [...]
607-
LINKER_VERSION_STRING=`$LINKER -Wl,--version 2>&1 | $HEAD -n 1`
607+
# If using gold it will look like:
608+
# GNU gold (GNU Binutils 2.30) 1.15
609+
LINKER_VERSION_STRING=`$LINKER -Wl,--version 2> /dev/null | $HEAD -n 1`
608610
# Extract version number
609-
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
610-
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
611+
if [ [[ "$LINKER_VERSION_STRING" == *gold* ]] ]; then
612+
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
613+
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*) .*/\1/'` ]
614+
else
615+
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
616+
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
617+
fi
611618
elif test "x$TOOLCHAIN_TYPE" = xclang; then
612619
# clang -Wl,-v output typically looks like
613620
# @(#)PROGRAM:ld PROJECT:ld64-305

make/conf/jib-profiles.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,18 +862,18 @@ var getJibProfilesProfiles = function (input, common, data) {
862862
var getJibProfilesDependencies = function (input, common) {
863863

864864
var devkit_platform_revisions = {
865-
linux_x64: "gcc7.3.0-OEL6.4+1.1",
865+
linux_x64: "gcc8.2.0-OL6.4+1.0",
866866
macosx_x64: "Xcode11.3.1-MacOSX10.15+1.0",
867867
solaris_x64: "SS12u4-Solaris11u1+1.0",
868868
solaris_sparcv9: "SS12u4-Solaris11u1+1.1",
869869
windows_x64: "VS2017-15.9.16+1.1",
870870
linux_aarch64: (input.profile != null && input.profile.indexOf("arm64") >= 0
871871
? "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0"
872-
: "gcc7.3.0-Fedora27+1.1"),
872+
: "gcc8.2.0-Fedora27+1.0"),
873873
linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0
874874
? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0"
875875
: (input.profile != null && input.profile.indexOf("arm32") >= 0
876-
? "gcc7.3.0-Fedora27+1.1"
876+
? "gcc8.2.0-Fedora27+1.0"
877877
: "arm-linaro-4.7+1.0"
878878
)
879879
)
@@ -893,6 +893,11 @@ var getJibProfilesDependencies = function (input, common) {
893893
}
894894
}
895895

896+
var devkit_cross_prefix = "";
897+
if (input.target_platform != input.build_platform) {
898+
devkit_cross_prefix = input.build_platform + "-to-";
899+
}
900+
896901
var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
897902
+ "-" + input.build_cpu;
898903

@@ -916,7 +921,7 @@ var getJibProfilesDependencies = function (input, common) {
916921
devkit: {
917922
organization: common.organization,
918923
ext: "tar.gz",
919-
module: "devkit-" + devkit_platform,
924+
module: "devkit-" + devkit_cross_prefix + devkit_platform,
920925
revision: devkit_platform_revisions[devkit_platform],
921926
environment: {
922927
"DEVKIT_HOME": input.get("devkit", "home_path"),

make/devkit/Makefile

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,10 @@
2929
# gcc based cross compilation, portable, self contained packages, capable
3030
# of building OpenJDK.
3131
#
32-
# In addition to the makefiles, access to Oracle Linux installation
33-
# media is required. This has been tested against Oracle Enterprise Linux
34-
# 6.4.
35-
#
3632
# By default this Makefile will build a native toolchain for the current
3733
# platform if called with something like this:
3834
#
39-
# make tars BASE_OS=OEL6
35+
# make tars BASE_OS=OL
4036
#
4137
# To build the full set of crosstools for additional platforms, use a command
4238
# line looking like this:
@@ -48,9 +44,19 @@
4844
# to build several devkits for a specific OS version at once.
4945
# You can find the final results under ../../build/devkit/result/<host>-to-<target>
5046
#
47+
# You may want the native toolchain to be used when compiling the cross
48+
# compilation toolchains. To achieve this, first build the native toolchain,
49+
# then add the bin directory from this build to the path when invoking this
50+
# makefile again for cross compilation. Ex:
51+
#
52+
# PATH=$PWD/../../build/devkit/result/x86_64-linux-gnu-to-x86_64-linux-gnu/bin:$PATH \
53+
# make TARGETS="arm-linux-gnueabihf,ppc64-linux-gnu" BASE_OS=Fedora
54+
#
5155
# This is the makefile which iterates over all host and target platforms.
5256
#
5357

58+
COMMA := ,
59+
5460
os := $(shell uname -o)
5561
cpu := $(shell uname -p)
5662

@@ -66,7 +72,7 @@ ifeq ($(TARGETS), )
6672
platforms := $(me)
6773
host_platforms := $(platforms)
6874
else
69-
platforms := $(TARGETS)
75+
platforms := $(subst $(COMMA), , $(TARGETS))
7076
host_platforms := $(me)
7177
endif
7278
target_platforms := $(platforms)
@@ -93,7 +99,7 @@ $(host_platforms) :
9399
$(MAKE) -f Tools.gmk all $(submakevars) \
94100
TARGET=$$p PREFIX=$(RESULT)/$@-to-$$p && \
95101
$(MAKE) -f Tools.gmk ccache $(submakevars) \
96-
TARGET=$@ PREFIX=$(RESULT)/$@-to-$$p BUILDDIR=$(OUTPUT_ROOT)/$@/$$p || exit 1 ; \
102+
TARGET=$@ PREFIX=$(RESULT)/$@-to-$$p || exit 1 ; \
97103
done
98104
@echo 'All done"'
99105

@@ -103,17 +109,14 @@ define Mktar
103109
$(1)-to-$(2)_tar = $$(RESULT)/sdk-$(1)-to-$(2)-$$(today).tar.gz
104110
$$($(1)-to-$(2)_tar) : PLATFORM = $(1)-to-$(2)
105111
TARFILES += $$($(1)-to-$(2)_tar)
106-
$$($(1)-to-$(2)_tar) : $$(shell find $$(RESULT)/$(1)-to-$(2) -type f)
107112
endef
108113

109114
$(foreach p,$(host_platforms),$(foreach t,$(target_platforms),$(eval $(call Mktar,$(p),$(t)))))
110115

111116
tars : all $(TARFILES)
112117
onlytars : $(TARFILES)
113118
%.tar.gz :
114-
@echo 'Creating compiler package $@'
115-
cd $(RESULT) && tar -czf $@ $(PLATFORM)/*
116-
touch $@
119+
$(MAKE) -r -f Tars.gmk SRC_DIR=$(RESULT)/$(PLATFORM) TAR_FILE=$@
117120

118121
clean :
119122
rm -rf $(addprefix ../../build/devkit/, result $(host_platforms))

make/devkit/Tars.gmk

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
3+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
#
5+
# This code is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License version 2 only, as
7+
# published by the Free Software Foundation. Oracle designates this
8+
# particular file as subject to the "Classpath" exception as provided
9+
# by Oracle in the LICENSE file that accompanied this code.
10+
#
11+
# This code is distributed in the hope that it will be useful, but WITHOUT
12+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
# version 2 for more details (a copy is included in the LICENSE file that
15+
# accompanied this code).
16+
#
17+
# You should have received a copy of the GNU General Public License version
18+
# 2 along with this work; if not, write to the Free Software Foundation,
19+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
#
21+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
# or visit www.oracle.com if you need additional information or have any
23+
# questions.
24+
#
25+
26+
# This makefile creates the tar files. It needs to be called with make -r
27+
# which is why it's separated out into its own file.
28+
29+
# Input parameters
30+
# SRC_DIR
31+
# TAR_FILE
32+
33+
ifeq ($(SRC_DIR), )
34+
$(error SRC_DIR not set)
35+
endif
36+
ifeq ($(TAR_FILE), )
37+
$(error TAR_FILE not set)
38+
endif
39+
40+
default: tars
41+
42+
tars : $(TAR_FILE)
43+
44+
$(TAR_FILE): $(shell find $(SRC_DIR) -type f)
45+
@echo 'Creating compiler package $@'
46+
cd $(dir $(SRC_DIR)) && tar -czf $@ $(notdir $(SRC_DIR))/*
47+
touch $@
48+
49+
.PHONY: default tars

make/devkit/Tools.gmk

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ endif
5151

5252
$(info ARCH=$(ARCH))
5353

54-
ifeq ($(BASE_OS), OEL6)
54+
ifeq ($(BASE_OS), OL)
5555
BASE_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
56-
LINUX_VERSION := OEL6.4
56+
LINUX_VERSION := OL6.4
5757
else ifeq ($(BASE_OS), Fedora)
5858
DEFAULT_OS_VERSION := 27
5959
ifeq ($(BASE_OS_VERSION), )
@@ -79,8 +79,17 @@ endif
7979
# Define external dependencies
8080

8181
# Latest that could be made to work.
82-
GCC_VER := 7.3.0
83-
ifeq ($(GCC_VER), 7.3.0)
82+
GCC_VER := 8.2.0
83+
ifeq ($(GCC_VER), 8.2.0)
84+
gcc_ver := gcc-8.2.0
85+
binutils_ver := binutils-2.30
86+
ccache_ver := ccache-3.5.1a
87+
CCACHE_DIRNAME := ccache-3.5.1
88+
mpfr_ver := mpfr-3.1.5
89+
gmp_ver := gmp-6.1.2
90+
mpc_ver := mpc-1.0.3
91+
gdb_ver := gdb-8.2.1
92+
else ifeq ($(GCC_VER), 7.3.0)
8493
gcc_ver := gcc-7.3.0
8594
binutils_ver := binutils-2.30
8695
ccache_ver := ccache-3.3.6
@@ -174,14 +183,16 @@ download-rpms:
174183

175184
# Generate downloading + unpacking of sources.
176185
define Download
177-
$(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))
186+
# Allow override
187+
$(1)_DIRNAME ?= $(basename $(basename $(notdir $($(1)))))
188+
$(1)_DIR = $(abspath $(SRCDIR)/$$($(1)_DIRNAME))
178189
$(1)_CFG = $$($(1)_DIR)/configure
179190
$(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)))
180191

181192
$$($(1)_CFG) : $$($(1)_FILE)
182193
mkdir -p $$(SRCDIR)
183194
tar -C $$(SRCDIR) -xf $$<
184-
$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \
195+
$$(foreach p,$$(abspath $$(wildcard patches/$$(notdir $$($(1)_DIR)).patch)), \
185196
echo PATCHING $$(p) ; \
186197
patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
187198
)

0 commit comments

Comments
 (0)