diff -r 46dc568d6804 make/autoconf/build-aux/config.guess
--- a/make/autoconf/build-aux/config.guess	Fri Apr 13 14:06:39 2018 +0200
+++ b/make/autoconf/build-aux/config.guess	Fri Apr 27 13:59:00 2018 +0200
@@ -86,6 +86,16 @@
   fi
 fi
 
+# Test and fix 64-bit RISC-V.
+# TODO: should be handled by autoconf-config.guess.
+if [ "x$OUT" = x ]; then
+  if [ `uname -m` = riscv64 ]; then
+    if [ `uname -s` = Linux ]; then
+      OUT=riscv64-unknown-linux-gnu
+    fi
+  fi
+fi
+
 # Test and fix cpu on Macosx when C preprocessor is not on the path
 echo $OUT | grep i386-apple-darwin > /dev/null 2> /dev/null
 if test $? = 0; then
diff -r 46dc568d6804 make/autoconf/flags.m4
--- a/make/autoconf/flags.m4	Fri Apr 13 14:06:39 2018 +0200
+++ b/make/autoconf/flags.m4	Fri Apr 27 13:59:00 2018 +0200
@@ -241,7 +241,8 @@
        test "x$OPENJDK_TARGET_CPU" != xmips &&
        test "x$OPENJDK_TARGET_CPU" != xmipsel &&
        test "x$OPENJDK_TARGET_CPU" != xmips64 &&
-       test "x$OPENJDK_TARGET_CPU" != xmips64el; then
+       test "x$OPENJDK_TARGET_CPU" != xmips64el &&
+       test "x$OPENJDK_TARGET_CPU" != xriscv64; then
       MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
     fi
   fi
diff -r 46dc568d6804 make/autoconf/platform.m4
--- a/make/autoconf/platform.m4	Fri Apr 13 14:06:39 2018 +0200
+++ b/make/autoconf/platform.m4	Fri Apr 27 13:59:00 2018 +0200
@@ -114,6 +114,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
diff -r 46dc568d6804 src/hotspot/os/linux/os_linux.cpp
--- a/src/hotspot/os/linux/os_linux.cpp	Fri Apr 13 14:06:39 2018 +0200
+++ b/src/hotspot/os/linux/os_linux.cpp	Fri Apr 27 13:59:00 2018 +0200
@@ -1765,6 +1765,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*)"RISC-V 64"},
   };
 
 #if  (defined IA32)
@@ -1799,9 +1800,11 @@
   static  Elf32_Half running_arch_code=EM_68K;
 #elif  (defined SH)
   static  Elf32_Half running_arch_code=EM_SH;
+#elif (defined __riscv) && (defined __riscv_xlen) && (__riscv_xlen == 64)
+  static  Elf32_Half running_arch_code=EM_RISCV;
 #else
     #error Method os::dll_load requires that one of following is defined:\
-        AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, S390, SH, __sparc
+        AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, __riscv, S390, SH, __sparc
 #endif
 
   // Identify compatability class for VM's architecture and library's architecture
