Skip to content

Commit c00692b

Browse files
author
Cheng Jin
committed
Update configure scripts for RISC-V in OMR (part1/misc)
The changes mainly include configure scripts to enable RISC-V 64bit from the OMR perspective. Issue: eclipse#4426 Signed-off-by: Cheng Jin <[email protected]>
1 parent dc3b095 commit c00692b

File tree

9 files changed

+166
-10
lines changed

9 files changed

+166
-10
lines changed

CONTRIBUTING.md

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ can be achieved with the following labels:
127127
* [**`arch:aarch32`**](https://github.com/eclipse/omr/labels/arch%3Aaarch32)
128128
* [**`arch:aarch64`**](https://github.com/eclipse/omr/labels/arch%3Aaarch64)
129129
* [**`arch:power`**](https://github.com/eclipse/omr/labels/arch%3Apower)
130+
* [**`arch:riscv`**](https://github.com/eclipse/omr/labels/arch%3Ariscv)
130131
* [**`arch:x86`**](https://github.com/eclipse/omr/labels/arch%3Ax86)
131132
* [**`arch:z`**](https://github.com/eclipse/omr/labels/arch%3Az)
132133
<br/>

cmake/modules/platform/arch/riscv.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121

2222
if(OMR_ENV_DATA64)
2323
list(APPEND OMR_PLATFORM_DEFINITIONS
24-
-D_RISCV64_
24+
-DRISCV
25+
-DRISCV64
2526
)
2627
else()
2728
list(APPEND OMR_PLATFORM_DEFINITIONS
28-
-D_RISCV32_
29+
-DRISCV
30+
-DRISCV32
2931
)
3032
endif()
3133

compiler/env/defines.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2018 IBM Corp. and others
2+
* Copyright (c) 2000, 2019 IBM Corp. and others
33
*
44
* This program and the accompanying materials are made available under
55
* the terms of the Eclipse Public License 2.0 which accompanies this
@@ -192,6 +192,10 @@
192192
# define TR_HOST_ARM64 1
193193
#endif
194194

195+
#if (HOST_ARCH == ARCH_RISCV)
196+
# define TR_HOST_RISCV 1
197+
#endif
198+
195199
/* @ddr_namespace: default */
196200

197201
/* FIXME: we need to document what these ifdefs do

configure

+39-3
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,7 @@ OMR_INTERP_SMALL_MONITOR_SLOT
686686
OMR_INTERP_COMPRESSED_OBJECT_HEADER
687687
OMR_GC_COMPRESSED_POINTERS
688688
OMR_ENV_DATA64
689+
OMR_ARCH_RISCV
689690
OMR_ARCH_S390
690691
OMR_ARCH_X86
691692
OMR_ARCH_AARCH64
@@ -792,6 +793,7 @@ infodir
792793
docdir
793794
oldincludedir
794795
includedir
796+
runstatedir
795797
localstatedir
796798
sharedstatedir
797799
sysconfdir
@@ -871,6 +873,7 @@ enable_OMR_ARCH_ARM
871873
enable_OMR_ARCH_AARCH64
872874
enable_OMR_ARCH_X86
873875
enable_OMR_ARCH_S390
876+
enable_OMR_ARCH_RISCV
874877
enable_OMR_ENV_DATA64
875878
enable_OMR_GC_COMPRESSED_POINTERS
876879
enable_OMR_INTERP_COMPRESSED_OBJECT_HEADER
@@ -969,6 +972,7 @@ datadir='${datarootdir}'
969972
sysconfdir='${prefix}/etc'
970973
sharedstatedir='${prefix}/com'
971974
localstatedir='${prefix}/var'
975+
runstatedir='${localstatedir}/run'
972976
includedir='${prefix}/include'
973977
oldincludedir='/usr/include'
974978
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1221,6 +1225,15 @@ do
12211225
| -silent | --silent | --silen | --sile | --sil)
12221226
silent=yes ;;
12231227

1228+
-runstatedir | --runstatedir | --runstatedi | --runstated \
1229+
| --runstate | --runstat | --runsta | --runst | --runs \
1230+
| --run | --ru | --r)
1231+
ac_prev=runstatedir ;;
1232+
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1233+
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1234+
| --run=* | --ru=* | --r=*)
1235+
runstatedir=$ac_optarg ;;
1236+
12241237
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
12251238
ac_prev=sbindir ;;
12261239
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1358,7 +1371,7 @@ fi
13581371
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
13591372
datadir sysconfdir sharedstatedir localstatedir includedir \
13601373
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1361-
libdir localedir mandir
1374+
libdir localedir mandir runstatedir
13621375
do
13631376
eval ac_val=\$$ac_var
13641377
# Remove trailing slashes.
@@ -1511,6 +1524,7 @@ Fine tuning of the installation directories:
15111524
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
15121525
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
15131526
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
1527+
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
15141528
--libdir=DIR object code libraries [EPREFIX/lib]
15151529
--includedir=DIR C header files [PREFIX/include]
15161530
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1647,6 +1661,7 @@ Optional Features:
16471661
16481662
--enable-OMR_ARCH_X86
16491663
--enable-OMR_ARCH_S390
1664+
--enable-OMR_ARCH_RISCV
16501665
--enable-OMR_ENV_DATA64
16511666
--enable-OMR_GC_COMPRESSED_POINTERS
16521667
@@ -1723,7 +1738,7 @@ Some influential environment variables:
17231738
aix,linux,osx,win,zos
17241739
OMR_HOST_ARCH
17251740
The architecture of the CPU where the package will run. One of:
1726-
aarch64,arm,ppc,s390,x86
1741+
aarch64,arm,ppc,riscv,s390,x86
17271742
OMR_TARGET_DATASIZE
17281743
Specifies whether the package will run in 32- or 64-bit mode.
17291744
One of: 31,32,64
@@ -2696,7 +2711,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
26962711
26972712
26982713
###############################################################################
2699-
# Copyright (c) 2015, 2018 IBM Corp. and others
2714+
# Copyright (c) 2015, 2019 IBM Corp. and others
27002715
#
27012716
# This program and the accompanying materials are made available under
27022717
# the terms of the Eclipse Public License 2.0 which accompanies this
@@ -4245,6 +4260,8 @@ if test "x$OMR_HOST_ARCH" = "x"; then :
42454260
OMR_HOST_ARCH=x86 ;; #(
42464261
x86_64) :
42474262
OMR_HOST_ARCH=x86 ;; #(
4263+
riscv64) :
4264+
OMR_HOST_ARCH=riscv ;; #(
42484265
*) :
42494266
as_fn_error $? "Unable to derive OMR_HOST_ARCH from host_cpu: $host_cpu" "$LINENO" 5
42504267
;;
@@ -5702,6 +5719,25 @@ else
57025719
fi
57035720
57045721
5722+
# Check whether --enable-OMR_ARCH_RISCV was given.
5723+
if test "${enable_OMR_ARCH_RISCV+set}" = set; then :
5724+
enableval=$enable_OMR_ARCH_RISCV; if test "x${enableval}" = xyes; then :
5725+
OMR_ARCH_RISCV=1
5726+
5727+
$as_echo "#define OMR_ARCH_RISCV 1" >>confdefs.h
5728+
5729+
else
5730+
OMR_ARCH_RISCV=0
5731+
5732+
5733+
fi
5734+
else
5735+
OMR_ARCH_RISCV=0
5736+
5737+
5738+
fi
5739+
5740+
57055741
57065742
# Check whether --enable-OMR_ENV_DATA64 was given.
57075743
if test "${enable_OMR_ENV_DATA64+set}" = set; then :

configure.ac

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ AC_ARG_VAR([OMRGLUE_INCLUDES], [Extra include directories to be passed to the C
4545
AC_ARG_VAR([lib_output_dir], [The output directory for libraries. (Default: $top_srcdir/lib)])
4646
AC_ARG_VAR([exe_output_dir], [The output directory for executables. (Default: $top_srcdir)])
4747
AC_ARG_VAR([OMR_HOST_OS], [The operating system where the package will run. One of: aix,linux,osx,win,zos])
48-
AC_ARG_VAR([OMR_HOST_ARCH], [The architecture of the CPU where the package will run. One of: aarch64,arm,ppc,s390,x86])
48+
AC_ARG_VAR([OMR_HOST_ARCH], [The architecture of the CPU where the package will run. One of: aarch64,arm,ppc,riscv,s390,x86])
4949
AC_ARG_VAR([OMR_TARGET_DATASIZE], [Specifies whether the package will run in 32- or 64-bit mode. One of: 31,32,64])
5050
AC_ARG_VAR([OMR_TOOLCHAIN], [The toolchain used to build the package. One of: gcc,xlc,msvc])
5151
AC_ARG_VAR([OMR_TOOLS_CC], [The C compiler to use for building tools (can differ from CC).])
@@ -424,6 +424,7 @@ OMRCFG_DEFINE_FLAG_OFF([OMR_ARCH_ARM])
424424
OMRCFG_DEFINE_FLAG_OFF([OMR_ARCH_AARCH64])
425425
OMRCFG_DEFINE_FLAG_OFF([OMR_ARCH_X86])
426426
OMRCFG_DEFINE_FLAG_OFF([OMR_ARCH_S390])
427+
OMRCFG_DEFINE_FLAG_OFF([OMR_ARCH_RISCV])
427428

428429
OMRCFG_DEFINE_FLAG([OMR_ENV_DATA64],[],
429430
[AS_IF([test "$OMR_TARGET_DATASIZE" = 64],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
###############################################################################
2+
# Copyright (c) 2019, 2019 IBM Corp. and others
3+
#
4+
# This program and the accompanying materials are made available under
5+
# the terms of the Eclipse Public License 2.0 which accompanies this
6+
# distribution and is available at http://eclipse.org/legal/epl-2.0
7+
# or the Apache License, Version 2.0 which accompanies this distribution
8+
# and is available at https://www.apache.org/licenses/LICENSE-2.0.
9+
#
10+
# This Source Code may also be made available under the following Secondary
11+
# Licenses when the conditions for such availability set forth in the
12+
# Eclipse Public License, v. 2.0 are satisfied: GNU General Public License,
13+
# version 2 with the GNU Classpath Exception [1] and GNU General Public
14+
# License, version 2 with the OpenJDK Assembly Exception [2].
15+
#
16+
# [1] https://www.gnu.org/software/classpath/license.html
17+
# [2] http://openjdk.java.net/legal/assembly-exception.html
18+
#
19+
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
20+
###############################################################################
21+
22+
include $(CONFIG_INCL_DIR)/configure_common.mk
23+
24+
RISCV_CROSSTOOLS_PREFIX=riscv64-unknown-linux-gnu
25+
26+
ifneq (,$(findstring _riscv64, $(SPEC)))
27+
RISCV_TARGET=riscv64-unknown-linux-gnu
28+
else
29+
RISCV_TARGET=riscv32-unknown-linux-gnu
30+
endif
31+
32+
CONFIGURE_ARGS += \
33+
--host=$(RISCV_TARGET) \
34+
--target=$(RISCV_TARGET)
35+
36+
ifneq (,$(findstring _cross, $(SPEC)))
37+
CONFIGURE_ARGS += \
38+
--build=x86_64-pc-linux-gnu \
39+
'OMR_CROSS_CONFIGURE=yes'
40+
else
41+
CONFIGURE_ARGS += \
42+
--build=riscv64-pc-linux-gnu
43+
endif
44+
45+
CONFIGURE_ARGS += \
46+
--enable-OMR_EXAMPLE \
47+
--enable-OMR_GC \
48+
--enable-OMR_PORT \
49+
--enable-OMR_TEST_COMPILER \
50+
--enable-OMR_THREAD \
51+
--enable-OMR_OMRSIG \
52+
--enable-OMR_THR_THREE_TIER_LOCKING \
53+
--enable-OMR_THR_YIELD_ALG \
54+
--enable-OMR_THR_SPIN_WAKE_CONTROL \
55+
--enable-OMRTHREAD_LIB_UNIX \
56+
--enable-OMR_ARCH_RISCV \
57+
--enable-OMR_ENV_LITTLE_ENDIAN \
58+
--enable-OMR_GC_TLH_PREFETCH_FTA \
59+
--enable-OMR_PORT_CAN_RESERVE_SPECIFIC_ADDRESS \
60+
--enable-OMR_THR_FORK_SUPPORT \
61+
--enable-OMR_GC_ARRAYLETS
62+
63+
ifneq (,$(findstring _riscv64, $(SPEC)))
64+
CONFIGURE_ARGS += \
65+
--enable-OMR_ENV_DATA64 \
66+
'OMR_TARGET_DATASIZE=64'
67+
else
68+
CONFIGURE_ARGS += \
69+
'OMR_TARGET_DATASIZE=32'
70+
endif
71+
72+
ifneq (,$(findstring _cmprssptrs, $(SPEC)))
73+
CONFIGURE_ARGS += \
74+
--enable-OMR_GC_COMPRESSED_POINTERS \
75+
--enable-OMR_INTERP_COMPRESSED_OBJECT_HEADER \
76+
--enable-OMR_INTERP_SMALL_MONITOR_SLOT
77+
endif
78+
79+
CONFIGURE_ARGS += libprefix=lib exeext= solibext=.so arlibext=.a objext=.o
80+
81+
ifneq (,$(findstring _cross, $(SPEC)))
82+
AR=$(RISCV_CROSSTOOLS_PREFIX)-ar
83+
AS=$(RISCV_CROSSTOOLS_PREFIX)-as
84+
CC=$(RISCV_CROSSTOOLS_PREFIX)-gcc $(SYSROOT_CFLAGS)
85+
CXX=$(RISCV_CROSSTOOLS_PREFIX)-c++ $(SYSROOT_CFLAGS)
86+
OBJCOPY=$(RISCV_CROSSTOOLS_PREFIX)-objcopy
87+
else
88+
AR=ar
89+
AS=as
90+
CC=gcc
91+
CXX=c++
92+
OBJCOPY=objcopy
93+
endif
94+
95+
CONFIGURE_ARGS += 'AR=$(AR)'
96+
CONFIGURE_ARGS += 'AS=$(AS)'
97+
CONFIGURE_ARGS += 'CC=$(CC)'
98+
CONFIGURE_ARGS += 'CXX=$(CXX)'
99+
CONFIGURE_ARGS += 'OBJCOPY=$(OBJCOPY)'
100+
CONFIGURE_ARGS += 'CCLINK=$$(CC)'
101+
CONFIGURE_ARGS += 'CXXLINKSHARED=$$(CC)'
102+
CONFIGURE_ARGS += 'CXXLINKEXE=$$(CXX)'
103+
104+
CONFIGURE_ARGS += 'OMR_HOST_OS=linux'
105+
CONFIGURE_ARGS += 'OMR_HOST_ARCH=riscv'
106+
CONFIGURE_ARGS += 'OMR_TOOLCHAIN=gcc'

omrmakefiles/confighelpers.m4

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (c) 2015, 2018 IBM Corp. and others
2+
# Copyright (c) 2015, 2019 IBM Corp. and others
33
#
44
# This program and the accompanying materials are made available under
55
# the terms of the Eclipse Public License 2.0 which accompanies this
@@ -55,6 +55,7 @@ AC_DEFUN([OMRCFG_CATEGORIZE_ARCH],
5555
[i686],[$1=x86],
5656
[ia64],[$1=x86],
5757
[x86_64],[$1=x86],
58+
[riscv64],[$1=riscv],
5859
[AC_MSG_ERROR([Unable to derive $1 from $2: $$2])]
5960
)]
6061
)

run_configure.mk

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (c) 2015, 2018 IBM Corp. and others
2+
# Copyright (c) 2015, 2019 IBM Corp. and others
33
#
44
# This program and the accompanying materials are made available under
55
# the terms of the Eclipse Public License 2.0 which accompanies this
@@ -77,6 +77,9 @@ endif
7777
ifneq (,$(findstring linux_ppc,$(SPEC)))
7878
include $(CONFIG_INCL_DIR)/configure_linux_ppc.mk
7979
endif
80+
ifneq (,$(findstring linux_riscv,$(SPEC)))
81+
include $(CONFIG_INCL_DIR)/configure_linux_riscv.mk
82+
endif
8083
ifneq (,$(findstring linux_x86,$(SPEC)))
8184
include $(CONFIG_INCL_DIR)/configure_linux_x86.mk
8285
endif

tools/configure

+3-1
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
21312131
21322132
21332133
###############################################################################
2134-
# Copyright (c) 2015, 2016 IBM Corp. and others
2134+
# Copyright (c) 2015, 2019 IBM Corp. and others
21352135
#
21362136
# This program and the accompanying materials are made available under
21372137
# the terms of the Eclipse Public License 2.0 which accompanies this
@@ -2297,6 +2297,8 @@ case $build_cpu in #(
22972297
OMR_BUILD_ARCH=x86 ;; #(
22982298
x86_64) :
22992299
OMR_BUILD_ARCH=x86 ;; #(
2300+
riscv64) :
2301+
OMR_BUILD_ARCH=riscv ;; #(
23002302
*) :
23012303
as_fn_error $? "Unable to derive OMR_BUILD_ARCH from build_cpu: $build_cpu" "$LINENO" 5
23022304
;;

0 commit comments

Comments
 (0)