Skip to content

Commit

Permalink
8220093: Change to GCC 8.2 for building on Linux at Oracle
Browse files Browse the repository at this point in the history
Reviewed-by: mbaesken
Backport-of: 290bfe5
  • Loading branch information
RealCLanger committed Mar 15, 2023
1 parent 97809af commit b8ac68d
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 25 deletions.
15 changes: 11 additions & 4 deletions make/autoconf/toolchain.m4
Expand Up @@ -600,14 +600,21 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
# gcc -Wl,-version output typically looks like
# gcc -Wl,-version output typically looks like:
# GNU ld (GNU Binutils for Ubuntu) 2.26.1
# Copyright (C) 2015 Free Software Foundation, Inc.
# This program is free software; [...]
LINKER_VERSION_STRING=`$LINKER -Wl,--version 2>&1 | $HEAD -n 1`
# If using gold it will look like:
# GNU gold (GNU Binutils 2.30) 1.15
LINKER_VERSION_STRING=`$LINKER -Wl,--version 2> /dev/null | $HEAD -n 1`
# Extract version number
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
if [ [[ "$LINKER_VERSION_STRING" == *gold* ]] ]; then
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*) .*/\1/'` ]
else
[ LINKER_VERSION_NUMBER=`$ECHO $LINKER_VERSION_STRING | \
$SED -e 's/.* \([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*/\1/'` ]
fi
elif test "x$TOOLCHAIN_TYPE" = xclang; then
# clang -Wl,-v output typically looks like
# @(#)PROGRAM:ld PROJECT:ld64-305
Expand Down
13 changes: 9 additions & 4 deletions make/conf/jib-profiles.js
Expand Up @@ -862,18 +862,18 @@ var getJibProfilesProfiles = function (input, common, data) {
var getJibProfilesDependencies = function (input, common) {

var devkit_platform_revisions = {
linux_x64: "gcc7.3.0-OEL6.4+1.1",
linux_x64: "gcc8.2.0-OL6.4+1.0",
macosx_x64: "Xcode11.3.1-MacOSX10.15+1.0",
solaris_x64: "SS12u4-Solaris11u1+1.0",
solaris_sparcv9: "SS12u4-Solaris11u1+1.1",
windows_x64: "VS2017-15.9.16+1.1",
linux_aarch64: (input.profile != null && input.profile.indexOf("arm64") >= 0
? "gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux+1.0"
: "gcc7.3.0-Fedora27+1.1"),
: "gcc8.2.0-Fedora27+1.0"),
linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0
? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0"
: (input.profile != null && input.profile.indexOf("arm32") >= 0
? "gcc7.3.0-Fedora27+1.1"
? "gcc8.2.0-Fedora27+1.0"
: "arm-linaro-4.7+1.0"
)
)
Expand All @@ -893,6 +893,11 @@ var getJibProfilesDependencies = function (input, common) {
}
}

var devkit_cross_prefix = "";
if (input.target_platform != input.build_platform) {
devkit_cross_prefix = input.build_platform + "-to-";
}

var boot_jdk_platform = (input.build_os == "macosx" ? "osx" : input.build_os)
+ "-" + input.build_cpu;

Expand All @@ -916,7 +921,7 @@ var getJibProfilesDependencies = function (input, common) {
devkit: {
organization: common.organization,
ext: "tar.gz",
module: "devkit-" + devkit_platform,
module: "devkit-" + devkit_cross_prefix + devkit_platform,
revision: devkit_platform_revisions[devkit_platform],
environment: {
"DEVKIT_HOME": input.get("devkit", "home_path"),
Expand Down
25 changes: 14 additions & 11 deletions make/devkit/Makefile
Expand Up @@ -29,14 +29,10 @@
# gcc based cross compilation, portable, self contained packages, capable
# of building OpenJDK.
#
# In addition to the makefiles, access to Oracle Linux installation
# media is required. This has been tested against Oracle Enterprise Linux
# 6.4.
#
# By default this Makefile will build a native toolchain for the current
# platform if called with something like this:
#
# make tars BASE_OS=OEL6
# make tars BASE_OS=OL
#
# To build the full set of crosstools for additional platforms, use a command
# line looking like this:
Expand All @@ -48,9 +44,19 @@
# to build several devkits for a specific OS version at once.
# You can find the final results under ../../build/devkit/result/<host>-to-<target>
#
# You may want the native toolchain to be used when compiling the cross
# compilation toolchains. To achieve this, first build the native toolchain,
# then add the bin directory from this build to the path when invoking this
# makefile again for cross compilation. Ex:
#
# PATH=$PWD/../../build/devkit/result/x86_64-linux-gnu-to-x86_64-linux-gnu/bin:$PATH \
# make TARGETS="arm-linux-gnueabihf,ppc64-linux-gnu" BASE_OS=Fedora
#
# This is the makefile which iterates over all host and target platforms.
#

COMMA := ,

os := $(shell uname -o)
cpu := $(shell uname -p)

Expand All @@ -66,7 +72,7 @@ ifeq ($(TARGETS), )
platforms := $(me)
host_platforms := $(platforms)
else
platforms := $(TARGETS)
platforms := $(subst $(COMMA), , $(TARGETS))
host_platforms := $(me)
endif
target_platforms := $(platforms)
Expand All @@ -93,7 +99,7 @@ $(host_platforms) :
$(MAKE) -f Tools.gmk all $(submakevars) \
TARGET=$$p PREFIX=$(RESULT)/$@-to-$$p && \
$(MAKE) -f Tools.gmk ccache $(submakevars) \
TARGET=$@ PREFIX=$(RESULT)/$@-to-$$p BUILDDIR=$(OUTPUT_ROOT)/$@/$$p || exit 1 ; \
TARGET=$@ PREFIX=$(RESULT)/$@-to-$$p || exit 1 ; \
done
@echo 'All done"'

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

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

tars : all $(TARFILES)
onlytars : $(TARFILES)
%.tar.gz :
@echo 'Creating compiler package $@'
cd $(RESULT) && tar -czf $@ $(PLATFORM)/*
touch $@
$(MAKE) -r -f Tars.gmk SRC_DIR=$(RESULT)/$(PLATFORM) TAR_FILE=$@

clean :
rm -rf $(addprefix ../../build/devkit/, result $(host_platforms))
Expand Down
49 changes: 49 additions & 0 deletions make/devkit/Tars.gmk
@@ -0,0 +1,49 @@
#
# Copyright (c) 2013, 2019, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#

# This makefile creates the tar files. It needs to be called with make -r
# which is why it's separated out into its own file.

# Input parameters
# SRC_DIR
# TAR_FILE

ifeq ($(SRC_DIR), )
$(error SRC_DIR not set)
endif
ifeq ($(TAR_FILE), )
$(error TAR_FILE not set)
endif

default: tars

tars : $(TAR_FILE)

$(TAR_FILE): $(shell find $(SRC_DIR) -type f)
@echo 'Creating compiler package $@'
cd $(dir $(SRC_DIR)) && tar -czf $@ $(notdir $(SRC_DIR))/*
touch $@

.PHONY: default tars
23 changes: 17 additions & 6 deletions make/devkit/Tools.gmk
Expand Up @@ -51,9 +51,9 @@ endif

$(info ARCH=$(ARCH))

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

# Latest that could be made to work.
GCC_VER := 7.3.0
ifeq ($(GCC_VER), 7.3.0)
GCC_VER := 8.2.0
ifeq ($(GCC_VER), 8.2.0)
gcc_ver := gcc-8.2.0
binutils_ver := binutils-2.30
ccache_ver := ccache-3.5.1a
CCACHE_DIRNAME := ccache-3.5.1
mpfr_ver := mpfr-3.1.5
gmp_ver := gmp-6.1.2
mpc_ver := mpc-1.0.3
gdb_ver := gdb-8.2.1
else ifeq ($(GCC_VER), 7.3.0)
gcc_ver := gcc-7.3.0
binutils_ver := binutils-2.30
ccache_ver := ccache-3.3.6
Expand Down Expand Up @@ -174,14 +183,16 @@ download-rpms:

# Generate downloading + unpacking of sources.
define Download
$(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1))))))
# Allow override
$(1)_DIRNAME ?= $(basename $(basename $(notdir $($(1)))))
$(1)_DIR = $(abspath $(SRCDIR)/$$($(1)_DIRNAME))
$(1)_CFG = $$($(1)_DIR)/configure
$(1)_FILE = $(DOWNLOAD)/$(notdir $($(1)))

$$($(1)_CFG) : $$($(1)_FILE)
mkdir -p $$(SRCDIR)
tar -C $$(SRCDIR) -xf $$<
$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \
$$(foreach p,$$(abspath $$(wildcard patches/$$(notdir $$($(1)_DIR)).patch)), \
echo PATCHING $$(p) ; \
patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
)
Expand Down

1 comment on commit b8ac68d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.