diff -ur openjdk/common/autoconf/platform.m4 openjdk.riscv/common/autoconf/platform.m4 --- openjdk/common/autoconf/platform.m4 2017-10-09 09:21:48.000000000 +0000 +++ openjdk.riscv/common/autoconf/platform.m4 2018-03-04 21:30:36.204000000 +0000 @@ -96,6 +96,18 @@ VAR_CPU_BITS=64 VAR_CPU_ENDIAN=big ;; + riscv32) + VAR_CPU=riscv32 + VAR_CPU_ARCH=riscv + VAR_CPU_BITS=32 + VAR_CPU_ENDIAN=little + ;; + riscv64) + VAR_CPU=riscv64 + VAR_CPU_ARCH=riscv + VAR_CPU_BITS=64 + VAR_CPU_ENDIAN=little + ;; *) AC_MSG_ERROR([unsupported cpu $1]) ;; diff -ur openjdk/hotspot/src/os/linux/vm/os_linux.cpp openjdk.riscv/hotspot/src/os/linux/vm/os_linux.cpp --- openjdk/hotspot/src/os/linux/vm/os_linux.cpp 2017-10-09 09:25:27.000000000 +0000 +++ openjdk.riscv/hotspot/src/os/linux/vm/os_linux.cpp 2018-03-04 21:31:58.308000000 +0000 @@ -1744,6 +1744,10 @@ #define EM_AARCH64 183 /* ARM AARCH64 */ #endif + #ifndef EM_RISCV + #define EM_RISCV 243 /* RISC-V */ + #endif + static const arch_t arch_array[]={ {EM_386, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"}, {EM_486, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"}, @@ -1766,6 +1770,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, ELFCLASSNONE, ELFDATA2MSB, (char*)"RISC-V"}, }; #if (defined IA32) @@ -1782,6 +1787,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) @@ -1800,7 +1807,7 @@ static Elf32_Half running_arch_code=EM_68K; #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, __sparc + AARCH64, ALPHA, ARM, AMD64, IA32, IA64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, __riscv, S390, __sparc #endif // Identify compatability class for VM's architecture and library's architecture @@ -1833,10 +1840,12 @@ } #ifndef S390 +#ifndef __riscv if (lib_arch.elf_class != arch_array[running_arch_index].elf_class) { ::snprintf(diag_msg_buf, diag_msg_max_length-1," (Possible cause: architecture word width mismatch)"); return NULL; } +#endif // __riscv #endif // !S390 if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) { Only in openjdk.riscv/hotspot/src/os/linux/vm: os_linux.cpp.orig