aports/community/openjdk8-corretto/icedtea-jdk-riscv64-zero.patch
Celeste 823c34d792 community/openjdk8-corretto: improve & enable zero variant when using bootstrap.sh
- enable all archs when $BOOTSTRAP is set to allow
    bootstrapping community/openjdk8 by cross-compilation,
    archs that fail to build server variant build zero instead

  - add patch to support zero variant on riscv64
    support for this is in Fedora, and has an upstream PR

  - add double quotes around "$CARCH" and "$CTARGET_ARCH"

  - use `$CBUILDROOT` instead of `$HOME/sysroot-$CTARGET_ARCH`

  - correct $_jarch for 32-bit ARM
    somehow, Corretto sets this differently from Icedtea
2024-09-11 06:10:46 +00:00

87 lines
3.2 KiB
Diff

Reference: https://src.fedoraproject.org/rpms/java-1.8.0-openjdk-portable/blob/f38/f/java-1.8.0-riscv-1.patch
Upstream: https://github.com/openjdk/jdk8u-dev/pull/573
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index a69736294..c9511ecd5 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -15275,6 +15275,12 @@ test -n "$target_alias" &&
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
+ riscv64)
+ VAR_CPU=riscv64
+ VAR_CPU_ARCH=riscv
+ VAR_CPU_BITS=64
+ VAR_CPU_ENDIAN=little
+ ;;
*)
as_fn_error $? "unsupported cpu $build_cpu" "$LINENO" 5
;;
@@ -15454,6 +15460,12 @@ printf "%s\n" "$OPENJDK_BUILD_LIBC" >&6; }
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
+ riscv64)
+ VAR_CPU=riscv64
+ VAR_CPU_ARCH=riscv
+ VAR_CPU_BITS=64
+ VAR_CPU_ENDIAN=little
+ ;;
*)
as_fn_error $? "unsupported cpu $host_cpu" "$LINENO" 5
;;
diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4
index 2cf396785..257d525a7 100644
--- a/common/autoconf/platform.m4
+++ b/common/autoconf/platform.m4
@@ -115,6 +115,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64
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/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 79e818674..0f62544fe 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -1981,6 +1981,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
#ifndef EM_LOONGARCH
#define EM_LOONGARCH 258 /* LoongArch */
#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"},
@@ -2005,6 +2008,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
{EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"},
{EM_AARCH64, EM_AARCH64, ELFCLASS64, ELFDATA2LSB, (char*)"AARCH64"},
{EM_LOONGARCH, EM_LOONGARCH, ELFCLASS64, ELFDATA2LSB, (char*)"LoongArch"},
+ {EM_RISCV, EM_RISCV, ELFCLASS64, ELFDATA2LSB, (char*)"RISC-V"},
};
#if (defined IA32)
@@ -2039,9 +2043,11 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen)
static Elf32_Half running_arch_code=EM_AARCH64;
#elif (defined LOONGARCH64)
static Elf32_Half running_arch_code=EM_LOONGARCH;
+ #elif (defined RISCV)
+ static Elf32_Half running_arch_code=EM_RISCV;
#else
#error Method os::dll_load requires that one of following is defined:\
- IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH64
+ IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K, AARCH64, LOONGARCH64, RISCV
#endif
// Identify compatability class for VM's architecture and library's architecture