Bug#1061730: openjfx: add loongarch64 support
Zhang Na
zhangna at loongson.cn
Mon Jan 29 09:26:48 GMT 2024
Source: openjfx
Version: 11.0.11+1-3.1
Severity: normal
X-Debbugs-Cc: zhangna at loongson.cn
Dear Maintainer,
I have a patch and a suggestion!
Firstly, I submitted a loongarch64's patch for openjfx-11, but it does not support webkit as the minimum version of LoongArch's g++ is 13;
Secondly, I suggest upgrading to the latest version of openjfx, which already supports LoongArch and also supports g++13, looking forward to your reply. Of course, I also saw the same question(#1023702 and #1041527), but there was no response, but I still look forward to it.
Thanks!
-- System Information:
Debian Release: trixie/sid
APT prefers unreleased
APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: loong64 (loongarch64)
Kernel: Linux 5.10.0-60.96.0.126.oe2203.loongarch64 (SMP w/32 CPU threads)
Locale: LANG=zh_CN.UTF-8, LC_CTYPE=zh_CN.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect
-------------- next part --------------
>From fc418a426205deb8e198f51a374bcfc125f96111 Mon Sep 17 00:00:00 2001
From: Zhang Na <zhangna at loongson.cn>
Date: Mon, 29 Jan 2024 08:37:58 +0000
Subject: [PATCH] Add LoongArch support
---
debian/control | 2 +-
debian/gradle.properties.loong64 | 4 ++++
debian/rules | 4 ++++
.../gstreamer/gstreamer-lite/gstreamer/gst/gstconfig.h | 2 +-
modules/javafx.web/src/main/native/CMakeLists.txt | 2 ++
.../src/main/native/Source/JavaScriptCore/CMakeLists.txt | 7 +++++++
.../ThirdParty/icu/source/i18n/double-conversion-utils.h | 2 +-
.../javafx.web/src/main/native/Source/WTF/wtf/PageBlock.h | 2 +-
.../src/main/native/Source/WTF/wtf/PlatformCPU.h | 6 ++++++
.../javafx.web/src/main/native/Source/WTF/wtf/dtoa/utils.h | 2 +-
10 files changed, 28 insertions(+), 5 deletions(-)
create mode 100644 debian/gradle.properties.loong64
diff --git a/debian/control b/debian/control
index d6bff1a3..aff82e6a 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Build-Depends: antlr4,
default-jdk,
default-jdk-doc,
flex,
- g++-11,
+ g++-11 [!loong64],
gperf,
gradle (>= 4.4),
gradle-debian-helper (>= 2.0),
diff --git a/debian/gradle.properties.loong64 b/debian/gradle.properties.loong64
new file mode 100644
index 00000000..47cc7b48
--- /dev/null
+++ b/debian/gradle.properties.loong64
@@ -0,0 +1,4 @@
+COMPILE_WEBKIT = false
+COMPILE_MEDIA = true
+GRADLE_VERSION_CHECK = false
+CONF = Release
diff --git a/debian/rules b/debian/rules
index 63f7f36a..4e4aafc0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,7 +19,11 @@ export NUMBER_OF_PROCESSORS ?= $(shell nproc)
dh $@ --buildsystem=gradle --no-parallel --with maven-repo-helper
override_dh_auto_configure-arch:
+ifneq (,$(filter $(DEB_HOST_ARCH), loong64))
+ cp debian/gradle.properties.loong64 gradle.properties
+else
cp debian/gradle.properties .
+endif
override_dh_auto_configure-indep:
echo "GRADLE_VERSION_CHECK = false" >> gradle.properties
diff --git a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstconfig.h b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstconfig.h
index c889459e..dbc9bcda 100644
--- a/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstconfig.h
+++ b/modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstconfig.h
@@ -107,7 +107,7 @@
*/
#if defined(__alpha__) || defined(__arc__) || defined(__arm__) || defined(__aarch64__) || defined(__bfin) || defined(__hppa__) || defined(__nios2__) || defined(__MICROBLAZE__) || defined(__mips__) || defined(__or1k__) || defined(__sh__) || defined(__SH4__) || defined(__sparc__) || defined(__sparc) || defined(__ia64__) || defined(_M_ALPHA) || defined(_M_ARM) || defined(_M_IA64) || defined(__xtensa__) || defined(__e2k__)
# define GST_HAVE_UNALIGNED_ACCESS 0
-#elif defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__m68k__) || defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || defined(__s390__) || defined(__s390x__) || defined(__zarch__)
+#elif defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__m68k__) || defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || defined(__s390__) || defined(__s390x__) || defined(__zarch__) || defined(__loongarch__)
# define GST_HAVE_UNALIGNED_ACCESS 1
#else
# error "Could not detect architecture; don't know whether it supports unaligned access! Please file a bug."
diff --git a/modules/javafx.web/src/main/native/CMakeLists.txt b/modules/javafx.web/src/main/native/CMakeLists.txt
index d8218bf3..27db7c15 100644
--- a/modules/javafx.web/src/main/native/CMakeLists.txt
+++ b/modules/javafx.web/src/main/native/CMakeLists.txt
@@ -116,6 +116,8 @@ elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
set(WTF_CPU_PPC64 1)
elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
set(WTF_CPU_PPC64LE 1)
+elseif (LOWERCASE_CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
+ set(WTF_CPU_LOONGARCH64 1)
else ()
set(WTF_CPU_UNKNOWN 1)
endif ()
diff --git a/modules/javafx.web/src/main/native/Source/JavaScriptCore/CMakeLists.txt b/modules/javafx.web/src/main/native/Source/JavaScriptCore/CMakeLists.txt
index b775b3ed..7f9dd169 100644
--- a/modules/javafx.web/src/main/native/Source/JavaScriptCore/CMakeLists.txt
+++ b/modules/javafx.web/src/main/native/Source/JavaScriptCore/CMakeLists.txt
@@ -252,6 +252,8 @@ else ()
set(OFFLINE_ASM_BACKEND "ARMv7")
elseif (WTF_CPU_MIPS)
set(OFFLINE_ASM_BACKEND "MIPS")
+ elseif (WTF_CPU_LOONGARCH64)
+ set(OFFLINE_ASM_BACKEND "LOONGARCH64")
endif ()
if (NOT ENABLE_JIT)
@@ -1333,7 +1335,12 @@ WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
if (COMPILER_IS_GCC_OR_CLANG)
# Avoid using fused multiply-add instructions since this could give different results
# for e.g. parseInt depending on the platform and compilation flags.
+ if (WTF_CPU_LOONGARCH64)
+ WEBKIT_ADD_TARGET_CXX_FLAGS(JavaScriptCore -ffp-contract=off)
+ else ()
WEBKIT_ADD_TARGET_CXX_FLAGS(JavaScriptCore -ffp-contract=off -fno-slp-vectorize)
+ endif ()
+
endif ()
WEBKIT_COPY_FILES(JavaScriptCore_CopyHeaders
diff --git a/modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/double-conversion-utils.h b/modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/double-conversion-utils.h
index 1e44fcaa..686425e8 100644
--- a/modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/double-conversion-utils.h
+++ b/modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/i18n/double-conversion-utils.h
@@ -103,7 +103,7 @@ int main(int argc, char** argv) {
defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \
defined(__riscv) || \
defined(__or1k__) || defined(__arc__) || \
- defined(__EMSCRIPTEN__)
+ defined(__EMSCRIPTEN__) || defined(__loongarch__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(__mc68000__) || \
defined(__pnacl__) || defined(__native_client__)
diff --git a/modules/javafx.web/src/main/native/Source/WTF/wtf/PageBlock.h b/modules/javafx.web/src/main/native/Source/WTF/wtf/PageBlock.h
index 2a618f69..e5e340c0 100644
--- a/modules/javafx.web/src/main/native/Source/WTF/wtf/PageBlock.h
+++ b/modules/javafx.web/src/main/native/Source/WTF/wtf/PageBlock.h
@@ -47,7 +47,7 @@ namespace WTF {
// 64 KiB. (Apple uses 16 KiB.)
//
// Use 64 KiB for any unknown CPUs to be conservative.
-#if OS(DARWIN) || PLATFORM(PLAYSTATION)
+#if OS(DARWIN) || PLATFORM(PLAYSTATION) || CPU(LOONGARCH64)
constexpr size_t CeilingOnPageSize = 16 * KB;
#elif USE(64KB_PAGE_BLOCK) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(UNKNOWN)
constexpr size_t CeilingOnPageSize = 64 * KB;
diff --git a/modules/javafx.web/src/main/native/Source/WTF/wtf/PlatformCPU.h b/modules/javafx.web/src/main/native/Source/WTF/wtf/PlatformCPU.h
index 58fef8f6..b1bf6019 100644
--- a/modules/javafx.web/src/main/native/Source/WTF/wtf/PlatformCPU.h
+++ b/modules/javafx.web/src/main/native/Source/WTF/wtf/PlatformCPU.h
@@ -55,6 +55,12 @@
#define WTF_MIPS_FP64 (defined __mips_fpr && __mips_fpr == 64)
#endif
+/* CPU(LOONGARCH64) - LOONGARCH64 */
+#if defined(__loongarch64)
+#define WTF_CPU_LOONGARCH64 1
+#define WTF_CPU_KNOWN 1
+#endif
+
/* CPU(PPC64) - PowerPC 64-bit Big Endian */
#if ( defined(__ppc64__) \
|| defined(__PPC64__)) \
diff --git a/modules/javafx.web/src/main/native/Source/WTF/wtf/dtoa/utils.h b/modules/javafx.web/src/main/native/Source/WTF/wtf/dtoa/utils.h
index 96d5bd7b..684d3fbc 100644
--- a/modules/javafx.web/src/main/native/Source/WTF/wtf/dtoa/utils.h
+++ b/modules/javafx.web/src/main/native/Source/WTF/wtf/dtoa/utils.h
@@ -91,7 +91,7 @@ int main(int argc, char** argv) {
defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \
defined(__riscv) || \
defined(__or1k__) || defined(__arc__) || \
- defined(__EMSCRIPTEN__)
+ defined(__EMSCRIPTEN__) || defined(__loongarch__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(__mc68000__) || \
defined(__pnacl__) || defined(__native_client__)
--
2.43.0
More information about the pkg-java-maintainers
mailing list