# HG changeset patch # User enevill # Date 1521543839 0 # Tue Mar 20 11:03:59 2018 +0000 # Node ID e37a8e4fb2ae989a2e51728c870ade3f9be25cfa # Parent 7ea4724a959c7f475e4450affb10269efa4927b9 8199138: Add RISC-V support to Zero Reviewed-by: aph, erikj, ehelin diff --git a/make/autoconf/build-aux/config.guess b/make/autoconf/build-aux/config.guess --- a/make/autoconf/build-aux/config.guess +++ b/make/autoconf/build-aux/config.guess @@ -27,6 +27,13 @@ # autoconf system (which might easily get lost in a future update), we wrap it # and fix the broken property, if needed. +machine=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +if test $machine = riscv64; then + # This is all we need to know for riscv64 + echo riscv64-unknown-linux-gnu + exit +fi + DIR=`dirname $0` OUT=`. $DIR/autoconf-config.guess` diff --git a/make/autoconf/build-aux/config.sub b/make/autoconf/build-aux/config.sub --- a/make/autoconf/build-aux/config.sub +++ b/make/autoconf/build-aux/config.sub @@ -29,8 +29,8 @@ DIR=`dirname $0` -# First, filter out everything that doesn't begin with "aarch64-" -if ! echo $* | grep '^aarch64-' >/dev/null ; then +# First, filter out everything that doesn't begin with "aarch64-" or "riscv64-" +if ! echo $* | grep '^aarch64-\|^riscv64-' >/dev/null ; then . $DIR/autoconf-config.sub "$@" # autoconf-config.sub exits, so we never reach here, but just in # case we do: @@ -45,6 +45,10 @@ config=`echo $1 | sed 's/^aarch64-/arm-/'` sub_args="$sub_args $config" shift; ;; + riscv64-* ) + config=`echo $1 | sed 's/^riscv64-/x86-/'` + sub_args="$sub_args $config" + shift; ;; - ) # Use stdin as input. sub_args="$sub_args $1" shift; break ;; @@ -57,7 +61,7 @@ result=`. $DIR/autoconf-config.sub $sub_args "$@"` exitcode=$? -result=`echo $result | sed "s/^arm-/aarch64-/"` +result=`echo $result | sed "s/^arm-/aarch64-/" | sed "s/^x86-/riscv64-/"` echo $result exit $exitcode diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4 --- a/make/autoconf/platform.m4 +++ b/make/autoconf/platform.m4 @@ -108,6 +108,12 @@ VAR_CPU_BITS=64 VAR_CPU_ENDIAN=little ;; + riscv64) + VAR_CPU=riscv64 + VAR_CPU_ARCH=riscv64 + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; s390) VAR_CPU=s390 VAR_CPU_ARCH=s390 @@ -469,6 +475,8 @@ HOTSPOT_$1_CPU_DEFINE=SPARC elif test "x$OPENJDK_$1_CPU" = xppc; then HOTSPOT_$1_CPU_DEFINE=PPC32 + elif test "x$OPENJDK_$1_CPU" = xriscv64; then + HOTSPOT_$1_CPU_DEFINE=RISCV64 elif test "x$OPENJDK_$1_CPU" = xs390; then HOTSPOT_$1_CPU_DEFINE=S390 elif test "x$OPENJDK_$1_CPU" = xs390x; then diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1733,6 +1733,9 @@ #ifndef EM_AARCH64 #define EM_AARCH64 183 /* ARM AARCH64 */ #endif +#ifndef EM_RISCV + #define EM_RISCV 243 +#endif static const arch_t arch_array[]={ {EM_386, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"}, @@ -1758,6 +1761,7 @@ {EM_PARISC, EM_PARISC, ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"}, {EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"}, {EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"}, + {EM_RISCV, EM_RISCV, ELFCLASS64, ELFDATA2LSB, (char*)"RISCV"}, }; #if (defined IA32) @@ -1774,6 +1778,8 @@ static Elf32_Half running_arch_code=EM_PPC64; #elif (defined __powerpc__) static Elf32_Half running_arch_code=EM_PPC; +#elif (defined RISCV) + static Elf32_Half running_arch_code=EM_RISCV; #elif (defined AARCH64) static Elf32_Half running_arch_code=EM_AARCH64; #elif (defined ARM) @@ -2309,6 +2315,8 @@ strncpy(cpuinfo, "IA64", length); #elif defined(PPC) strncpy(cpuinfo, "PPC64", length); +#elif defined(RISCV) + strncpy(cpuinfo, "RISCV", length); #elif defined(S390) strncpy(cpuinfo, "S390", length); #elif defined(SPARC)