java-openjdk/java-10-openjdk-riscv64.patch

73 lines
2.8 KiB
Diff

diff --git a/openjdk/make/autoconf/platform.m4 b/openjdk/make/autoconf/platform.m4
index f62f94daa..0c1ee2cca 100644
--- a/openjdk/make/autoconf/platform.m4
+++ b/openjdk/make/autoconf/platform.m4
@@ -144,6 +144,18 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
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 --git a/openjdk/src/hotspot/os/linux/os_linux.cpp b/openjdk/src/hotspot/os/linux/os_linux.cpp
index a91fac1b9..1654bd751 100644
--- a/openjdk/src/hotspot/os/linux/os_linux.cpp
+++ b/openjdk/src/hotspot/os/linux/os_linux.cpp
@@ -1738,6 +1738,10 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
#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"},
@@ -1762,6 +1766,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{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)
@@ -1796,9 +1801,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_68K;
#elif (defined SH)
static Elf32_Half running_arch_code=EM_SH;
+#elif (defined __riscv)
+ 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__, S390, SH, __sparc, __riscv
#endif
// Identify compatability class for VM's architecture and library's architecture
@@ -1831,10 +1838,12 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
}
#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) {