8297851: Add devkit for RISC-V

Reviewed-by: fyang, erikj
This commit is contained in:
Magnus Ihse Bursie 2023-01-18 16:16:51 +00:00
parent c3242ee452
commit c205caead5
3 changed files with 76 additions and 23 deletions

View File

@ -242,7 +242,8 @@ var getJibProfilesCommon = function (input, data) {
common.main_profile_names = [
"linux-x64", "linux-x86", "macosx-x64", "macosx-aarch64",
"windows-x64", "windows-x86", "windows-aarch64",
"linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x"
"linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x",
"linux-riscv64"
];
// These are the base settings for all the main build profiles.
@ -519,6 +520,17 @@ var getJibProfilesProfiles = function (input, common, data) {
"--disable-warnings-as-errors"
],
},
"linux-riscv64": {
target_os: "linux",
target_cpu: "riscv64",
build_cpu: "x64",
dependencies: ["devkit", "gtest", "build_devkit"],
configure_args: [
"--openjdk-target=riscv64-linux-gnu", "--with-freetype=bundled",
"--disable-warnings-as-errors"
],
},
};
// Add the base settings to all the main profiles
@ -714,7 +726,10 @@ var getJibProfilesProfiles = function (input, common, data) {
},
"linux-s390x": {
platform: "linux-s390x",
}
},
"linux-riscv64": {
platform: "linux-riscv64",
},
}
// Generate common artifacts for all main profiles
Object.keys(artifactData).forEach(function (name) {
@ -1040,7 +1055,8 @@ var getJibProfilesDependencies = function (input, common) {
linux_aarch64: "gcc11.2.0-OL7.6+1.0",
linux_arm: "gcc8.2.0-Fedora27+1.0",
linux_ppc64le: "gcc8.2.0-Fedora27+1.0",
linux_s390x: "gcc8.2.0-Fedora27+1.0"
linux_s390x: "gcc8.2.0-Fedora27+1.0",
linux_riscv64: "gcc11.3.0-Fedora_rawhide_68692+1.1"
};
var devkit_platform = (input.target_cpu == "x86"

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2022, 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
@ -63,20 +63,28 @@ ifeq ($(BASE_OS), OL)
LINUX_VERSION := OL6.4
endif
else ifeq ($(BASE_OS), Fedora)
DEFAULT_OS_VERSION := 27
ifeq ($(BASE_OS_VERSION), )
BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
endif
ifeq ($(filter x86_64 armhfp, $(ARCH)), )
FEDORA_TYPE := fedora-secondary
ifeq ($(ARCH), riscv64)
DEFAULT_OS_VERSION := rawhide/68692
ifeq ($(BASE_OS_VERSION), )
BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
endif
BASE_URL := http://fedora.riscv.rocks/repos-dist/$(BASE_OS_VERSION)/$(ARCH)/Packages/
else
FEDORA_TYPE := fedora/linux
endif
ARCHIVED := $(shell [ $(BASE_OS_VERSION) -lt $(DEFAULT_OS_VERSION) ] && echo true)
ifeq ($(ARCHIVED),true)
BASE_URL := https://archives.fedoraproject.org/pub/archive/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
else
BASE_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
DEFAULT_OS_VERSION := 27
ifeq ($(BASE_OS_VERSION), )
BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
endif
ifeq ($(filter x86_64 armhfp, $(ARCH)), )
FEDORA_TYPE := fedora-secondary
else
FEDORA_TYPE := fedora/linux
endif
ARCHIVED := $(shell [ $(BASE_OS_VERSION) -lt $(DEFAULT_OS_VERSION) ] && echo true)
ifeq ($(ARCHIVED),true)
BASE_URL := https://archives.fedoraproject.org/pub/archive/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
else
BASE_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
endif
endif
LINUX_VERSION := Fedora_$(BASE_OS_VERSION)
else
@ -87,8 +95,17 @@ endif
# Define external dependencies
# Latest that could be made to work.
GCC_VER := 11.2.0
ifeq ($(GCC_VER), 11.2.0)
GCC_VER := 11.3.0
ifeq ($(GCC_VER), 11.3.0)
gcc_ver := gcc-11.3.0
binutils_ver := binutils-2.39
ccache_ver := ccache-3.7.12
mpfr_ver := mpfr-4.1.1
gmp_ver := gmp-6.2.1
mpc_ver := mpc-1.2.1
gdb_ver := gdb-11.2
REQUIRED_MIN_MAKE_MAJOR_VERSION := 4
else ifeq ($(GCC_VER), 11.2.0)
gcc_ver := gcc-11.2.0
binutils_ver := binutils-2.37
ccache_ver := ccache-3.7.12
@ -189,7 +206,7 @@ RPM_LIST := \
libXi libXi-devel \
libXdmcp libXdmcp-devel \
libXau libXau-devel \
libgcc \
libgcc libxcrypt \
zlib zlib-devel \
libffi libffi-devel \
fontconfig fontconfig-devel \
@ -245,7 +262,7 @@ define Download
$$($(1)_CFG) : $$($(1)_FILE)
mkdir -p $$(SRCDIR)
tar -C $$(SRCDIR) -xf $$<
$$(foreach p,$$(abspath $$(wildcard patches/$$(notdir $$($(1)_DIR)).patch)), \
$$(foreach p,$$(abspath $$(wildcard patches/$$(ARCH)-$$(notdir $$($(1)_DIR)).patch)), \
echo PATCHING $$(p) ; \
patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
)
@ -414,6 +431,12 @@ $(gcc) \
# wants.
$(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
ifneq ($(ARCH), riscv64)
# gold is not available for riscv64 for some reason,
# and subsequent linking will fail if we try to enable it.
LINKER_CONFIG := --enable-gold=default
endif
# Makefile creation. Simply run configure in build dir.
# Setting CFLAGS to -O2 generates a much faster ld.
$(bfdmakes) \
@ -426,11 +449,11 @@ $(BUILDDIR)/$(binutils_ver)/Makefile \
$(PATHPRE) $(ENVS) CFLAGS="-O2 $(CFLAGS)" \
$(BINUTILS_CFG) \
$(CONFIG) \
$(LINKER_CONFIG) \
--with-sysroot=$(SYSROOT) \
--disable-nls \
--program-prefix=$(TARGET)- \
--enable-multilib \
--enable-gold=default \
--enable-threads \
--enable-plugins \
) > $(@D)/log.config 2>&1
@ -494,7 +517,7 @@ ifeq ($(ARCH), armhfp)
$(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --with-float=hard
endif
ifneq ($(filter ppc64 ppc64le s390x, $(ARCH)), )
ifneq ($(filter riscv64 ppc64 ppc64le s390x, $(ARCH)), )
# We only support 64-bit on these platforms anyway
CONFIG += --disable-multilib
endif

View File

@ -0,0 +1,14 @@
diff -ur a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp 2022-11-30 12:25:37.363419659 +0100
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp 2022-11-30 12:42:48.135412054 +0100
@@ -59,7 +59,9 @@
#if !SANITIZER_ANDROID
#include <fstab.h>
-#include <sys/mount.h>
+// sys/mount.h conflicts with linux/fs.h in glibc 2.36+
+// See https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
+// This has been fixed elsewhere, but apparently not in Fedora riscv.
#include <sys/timeb.h>
#include <utmpx.h>
#endif