Files
rpi-buildroot/package/openjdk/17.0.12+7/0001-Add-ARCv2-ISA-processors-support-to-Zero.patch
Thomas Devoogdt 51e8f2adaf package/openjdk: fix patch subdirectories
This commit fixes the wrong patch folders which should have been fixed
in commit 475c79d ("package/openjdk{-bin}: bump versions to 17.0.12+7
and 21.0.4+7")

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit f2992604a3267a1c5e12dfd1280199c388b9dd75)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
2026-01-09 16:31:11 +01:00

110 lines
4.3 KiB
Diff

From edf96f51d2c6d6e7a7762a879b916a5e58d8c23c Mon Sep 17 00:00:00 2001
From: Alexey Brodkin <abrodkin@synopsys.com>
Date: Mon, 18 Oct 2021 05:20:05 -0700
Subject: [PATCH] Add ARCv2 ISA processors support to Zero
This adds ARCv2 processors support in OpenJDK via
"Zero Assembly Project" (see https://openjdk.java.net/projects/zero).
That' a purely interpretive mode, so likely not that fast
as JIT'ed version, but for starters it's much better than nothing.
Once all the logistical problems are solved hopefully this
change will be accepted upstream.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
make/autoconf/libraries.m4 | 8 ++++++++
make/autoconf/platform.m4 | 8 ++++++++
src/hotspot/os/linux/os_linux.cpp | 8 +++++++-
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
index 865feea36d9..30c224e4a99 100644
--- a/make/autoconf/libraries.m4
+++ b/make/autoconf/libraries.m4
@@ -146,6 +146,14 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
fi
fi
+ # Libatomic library
+ # 32-bit ARC needs fallback library for 8-byte atomic ops
+ # Inspired by a fix for MIPS, see https://github.com/openjdk/jdk/commit/1b3aa3af
+ if test "x$OPENJDK_TARGET_OS" = xlinux &&
+ (test "x$OPENJDK_TARGET_CPU" = xarc); then
+ BASIC_JVM_LIBS="$BASIC_JVM_LIBS -latomic"
+ fi
+
# perfstat lib
if test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lperfstat"
diff --git a/make/autoconf/platform.m4 b/make/autoconf/platform.m4
index eb66266262b..3ca94b351b2 100644
--- a/make/autoconf/platform.m4
+++ b/make/autoconf/platform.m4
@@ -54,6 +54,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
+ arc)
+ VAR_CPU=arc
+ VAR_CPU_ARCH=arc
+ VAR_CPU_BITS=32
+ VAR_CPU_ENDIAN=little
+ ;;
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
@@ -565,6 +571,8 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
HOTSPOT_$1_CPU_DEFINE=RISCV64
# The cpu defines below are for zero, we don't support them directly.
+ elif test "x$OPENJDK_$1_CPU" = xarc; then
+ HOTSPOT_$1_CPU_DEFINE=ARC
elif test "x$OPENJDK_$1_CPU" = xsparc; then
HOTSPOT_$1_CPU_DEFINE=SPARC
elif test "x$OPENJDK_$1_CPU" = xppc; then
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index 63b7562f118..58b43241df4 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -1721,6 +1721,9 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
#ifndef EM_AARCH64
#define EM_AARCH64 183 /* ARM AARCH64 */
#endif
+#ifndef EM_ARC_COMPACT2
+ #define EM_ARC_COMPACT2 195 /* ARC ARCv2 ISA */
+#endif
#ifndef EM_RISCV
#define EM_RISCV 243 /* RISC-V */
#endif
@@ -1745,6 +1748,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
{EM_SH, EM_SH, ELFCLASS32, ELFDATA2MSB, (char*)"SuperH BE"},
#endif
{EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"},
+ {EM_ARC_COMPACT2, EM_ARC_COMPACT2, ELFCLASS32, ELFDATA2LSB, (char*)"ARC"},
// we only support 64 bit z architecture
{EM_S390, EM_S390, ELFCLASS64, ELFDATA2MSB, (char*)"IBM System/390"},
{EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"},
@@ -1773,6 +1777,8 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_PPC;
#elif (defined AARCH64)
static Elf32_Half running_arch_code=EM_AARCH64;
+#elif (defined ARC)
+ static Elf32_Half running_arch_code=EM_ARC_COMPACT2;
#elif (defined ARM)
static Elf32_Half running_arch_code=EM_ARM;
#elif (defined S390)
@@ -1795,7 +1801,7 @@ void * os::dll_load(const char *filename, char *ebuf, int ebuflen) {
static Elf32_Half running_arch_code=EM_LOONGARCH;
#else
#error Method os::dll_load requires that one of following is defined:\
- AARCH64, ALPHA, ARM, AMD64, IA32, IA64, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
+ AARCH64, ALPHA, ARC, ARM, AMD64, IA32, IA64, LOONGARCH64, M68K, MIPS, MIPSEL, PARISC, __powerpc__, __powerpc64__, RISCV, S390, SH, __sparc
#endif
// Identify compatibility class for VM's architecture and library's architecture
--
2.43.0