Skip to content

Commit c205cae

Browse files
committed
8297851: Add devkit for RISC-V
Reviewed-by: fyang, erikj
1 parent c3242ee commit c205cae

File tree

3 files changed

+76
-23
lines changed

3 files changed

+76
-23
lines changed

make/conf/jib-profiles.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ var getJibProfilesCommon = function (input, data) {
242242
common.main_profile_names = [
243243
"linux-x64", "linux-x86", "macosx-x64", "macosx-aarch64",
244244
"windows-x64", "windows-x86", "windows-aarch64",
245-
"linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x"
245+
"linux-aarch64", "linux-arm32", "linux-ppc64le", "linux-s390x",
246+
"linux-riscv64"
246247
];
247248

248249
// These are the base settings for all the main build profiles.
@@ -519,6 +520,17 @@ var getJibProfilesProfiles = function (input, common, data) {
519520
"--disable-warnings-as-errors"
520521
],
521522
},
523+
524+
"linux-riscv64": {
525+
target_os: "linux",
526+
target_cpu: "riscv64",
527+
build_cpu: "x64",
528+
dependencies: ["devkit", "gtest", "build_devkit"],
529+
configure_args: [
530+
"--openjdk-target=riscv64-linux-gnu", "--with-freetype=bundled",
531+
"--disable-warnings-as-errors"
532+
],
533+
},
522534
};
523535

524536
// Add the base settings to all the main profiles
@@ -714,7 +726,10 @@ var getJibProfilesProfiles = function (input, common, data) {
714726
},
715727
"linux-s390x": {
716728
platform: "linux-s390x",
717-
}
729+
},
730+
"linux-riscv64": {
731+
platform: "linux-riscv64",
732+
},
718733
}
719734
// Generate common artifacts for all main profiles
720735
Object.keys(artifactData).forEach(function (name) {
@@ -1040,7 +1055,8 @@ var getJibProfilesDependencies = function (input, common) {
10401055
linux_aarch64: "gcc11.2.0-OL7.6+1.0",
10411056
linux_arm: "gcc8.2.0-Fedora27+1.0",
10421057
linux_ppc64le: "gcc8.2.0-Fedora27+1.0",
1043-
linux_s390x: "gcc8.2.0-Fedora27+1.0"
1058+
linux_s390x: "gcc8.2.0-Fedora27+1.0",
1059+
linux_riscv64: "gcc11.3.0-Fedora_rawhide_68692+1.1"
10441060
};
10451061

10461062
var devkit_platform = (input.target_cpu == "x86"

make/devkit/Tools.gmk

+43-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2022, 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
@@ -63,20 +63,28 @@ ifeq ($(BASE_OS), OL)
6363
LINUX_VERSION := OL6.4
6464
endif
6565
else ifeq ($(BASE_OS), Fedora)
66-
DEFAULT_OS_VERSION := 27
67-
ifeq ($(BASE_OS_VERSION), )
68-
BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
69-
endif
70-
ifeq ($(filter x86_64 armhfp, $(ARCH)), )
71-
FEDORA_TYPE := fedora-secondary
72-
else
73-
FEDORA_TYPE := fedora/linux
74-
endif
75-
ARCHIVED := $(shell [ $(BASE_OS_VERSION) -lt $(DEFAULT_OS_VERSION) ] && echo true)
76-
ifeq ($(ARCHIVED),true)
77-
BASE_URL := https://archives.fedoraproject.org/pub/archive/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
66+
ifeq ($(ARCH), riscv64)
67+
DEFAULT_OS_VERSION := rawhide/68692
68+
ifeq ($(BASE_OS_VERSION), )
69+
BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
70+
endif
71+
BASE_URL := http://fedora.riscv.rocks/repos-dist/$(BASE_OS_VERSION)/$(ARCH)/Packages/
7872
else
79-
BASE_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
73+
DEFAULT_OS_VERSION := 27
74+
ifeq ($(BASE_OS_VERSION), )
75+
BASE_OS_VERSION := $(DEFAULT_OS_VERSION)
76+
endif
77+
ifeq ($(filter x86_64 armhfp, $(ARCH)), )
78+
FEDORA_TYPE := fedora-secondary
79+
else
80+
FEDORA_TYPE := fedora/linux
81+
endif
82+
ARCHIVED := $(shell [ $(BASE_OS_VERSION) -lt $(DEFAULT_OS_VERSION) ] && echo true)
83+
ifeq ($(ARCHIVED),true)
84+
BASE_URL := https://archives.fedoraproject.org/pub/archive/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
85+
else
86+
BASE_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/$(BASE_OS_VERSION)/Everything/$(ARCH)/os/Packages/
87+
endif
8088
endif
8189
LINUX_VERSION := Fedora_$(BASE_OS_VERSION)
8290
else
@@ -87,8 +95,17 @@ endif
8795
# Define external dependencies
8896

8997
# Latest that could be made to work.
90-
GCC_VER := 11.2.0
91-
ifeq ($(GCC_VER), 11.2.0)
98+
GCC_VER := 11.3.0
99+
ifeq ($(GCC_VER), 11.3.0)
100+
gcc_ver := gcc-11.3.0
101+
binutils_ver := binutils-2.39
102+
ccache_ver := ccache-3.7.12
103+
mpfr_ver := mpfr-4.1.1
104+
gmp_ver := gmp-6.2.1
105+
mpc_ver := mpc-1.2.1
106+
gdb_ver := gdb-11.2
107+
REQUIRED_MIN_MAKE_MAJOR_VERSION := 4
108+
else ifeq ($(GCC_VER), 11.2.0)
92109
gcc_ver := gcc-11.2.0
93110
binutils_ver := binutils-2.37
94111
ccache_ver := ccache-3.7.12
@@ -189,7 +206,7 @@ RPM_LIST := \
189206
libXi libXi-devel \
190207
libXdmcp libXdmcp-devel \
191208
libXau libXau-devel \
192-
libgcc \
209+
libgcc libxcrypt \
193210
zlib zlib-devel \
194211
libffi libffi-devel \
195212
fontconfig fontconfig-devel \
@@ -245,7 +262,7 @@ define Download
245262
$$($(1)_CFG) : $$($(1)_FILE)
246263
mkdir -p $$(SRCDIR)
247264
tar -C $$(SRCDIR) -xf $$<
248-
$$(foreach p,$$(abspath $$(wildcard patches/$$(notdir $$($(1)_DIR)).patch)), \
265+
$$(foreach p,$$(abspath $$(wildcard patches/$$(ARCH)-$$(notdir $$($(1)_DIR)).patch)), \
249266
echo PATCHING $$(p) ; \
250267
patch -d $$($(1)_DIR) -p1 -i $$(p) ; \
251268
)
@@ -414,6 +431,12 @@ $(gcc) \
414431
# wants.
415432
$(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS))
416433

434+
ifneq ($(ARCH), riscv64)
435+
# gold is not available for riscv64 for some reason,
436+
# and subsequent linking will fail if we try to enable it.
437+
LINKER_CONFIG := --enable-gold=default
438+
endif
439+
417440
# Makefile creation. Simply run configure in build dir.
418441
# Setting CFLAGS to -O2 generates a much faster ld.
419442
$(bfdmakes) \
@@ -426,11 +449,11 @@ $(BUILDDIR)/$(binutils_ver)/Makefile \
426449
$(PATHPRE) $(ENVS) CFLAGS="-O2 $(CFLAGS)" \
427450
$(BINUTILS_CFG) \
428451
$(CONFIG) \
452+
$(LINKER_CONFIG) \
429453
--with-sysroot=$(SYSROOT) \
430454
--disable-nls \
431455
--program-prefix=$(TARGET)- \
432456
--enable-multilib \
433-
--enable-gold=default \
434457
--enable-threads \
435458
--enable-plugins \
436459
) > $(@D)/log.config 2>&1
@@ -494,7 +517,7 @@ ifeq ($(ARCH), armhfp)
494517
$(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --with-float=hard
495518
endif
496519

497-
ifneq ($(filter ppc64 ppc64le s390x, $(ARCH)), )
520+
ifneq ($(filter riscv64 ppc64 ppc64le s390x, $(ARCH)), )
498521
# We only support 64-bit on these platforms anyway
499522
CONFIG += --disable-multilib
500523
endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff -ur a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
2+
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp 2022-11-30 12:25:37.363419659 +0100
3+
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp 2022-11-30 12:42:48.135412054 +0100
4+
@@ -59,7 +59,9 @@
5+
6+
#if !SANITIZER_ANDROID
7+
#include <fstab.h>
8+
-#include <sys/mount.h>
9+
+// sys/mount.h conflicts with linux/fs.h in glibc 2.36+
10+
+// See https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
11+
+// This has been fixed elsewhere, but apparently not in Fedora riscv.
12+
#include <sys/timeb.h>
13+
#include <utmpx.h>
14+
#endif

0 commit comments

Comments
 (0)