jffi/add-loongarch64-support-for-jffi.patch

70 lines
2.6 KiB
Diff
Raw Normal View History

2023-05-16 20:40:59 +08:00
---
jni/GNUmakefile | 2 +-
2023-09-26 17:31:16 +08:00
src/main/java/com/kenai/jffi/Platform.java | 7 ++++++-
2023-05-16 20:40:59 +08:00
src/main/java/com/kenai/jffi/internal/StubLoader.java | 4 ++++
2023-09-26 17:31:16 +08:00
3 files changed, 11 insertions(+), 2 deletions(-)
2023-05-16 20:40:59 +08:00
diff --git a/jni/GNUmakefile b/jni/GNUmakefile
2023-09-26 17:31:16 +08:00
index 40f5275..3be8d08 100755
2023-05-16 20:40:59 +08:00
--- a/jni/GNUmakefile
+++ b/jni/GNUmakefile
2023-09-26 17:31:16 +08:00
@@ -238,7 +238,7 @@ ifeq ($(CPU), sparcv9)
2023-05-16 20:40:59 +08:00
MODEL=64
endif
2023-09-26 17:31:16 +08:00
-ifneq ($(findstring $(CPU), x86_64 amd64 ppc64 ppc64le powerpc64 s390x aarch64 mips64 mips64el),)
+ifneq ($(findstring $(CPU), x86_64 amd64 ppc64 ppc64le powerpc64 s390x aarch64 mips64 mips64el loongarch64),)
2023-05-16 20:40:59 +08:00
MODEL = 64
endif
diff --git a/src/main/java/com/kenai/jffi/Platform.java b/src/main/java/com/kenai/jffi/Platform.java
2023-09-26 17:31:16 +08:00
index 8850426..4900194 100644
2023-05-16 20:40:59 +08:00
--- a/src/main/java/com/kenai/jffi/Platform.java
+++ b/src/main/java/com/kenai/jffi/Platform.java
2023-09-26 17:31:16 +08:00
@@ -102,7 +102,9 @@ public abstract class Platform {
2023-05-16 20:40:59 +08:00
ARM(32),
/** AARCH64 */
AARCH64(64),
2023-09-26 17:31:16 +08:00
- /** MIPS64EL */
+ /** LOONGARCH64*/
2023-05-16 20:40:59 +08:00
+ LOONGARCH64(64),
2023-09-26 17:31:16 +08:00
+ /** MIPS64EL */
MIPS64EL(64),
2023-05-16 20:40:59 +08:00
/** Unknown CPU */
UNKNOWN(64);
2023-09-26 17:31:16 +08:00
@@ -238,6 +240,9 @@ public abstract class Platform {
2023-05-16 20:40:59 +08:00
} else if (Util.equalsIgnoreCase("aarch64", archString, LOCALE)) {
return CPU.AARCH64;
2023-09-26 17:31:16 +08:00
2023-05-16 20:40:59 +08:00
+ } else if (Util.equalsIgnoreCase("loongarch64", archString, LOCALE)) {
+ return CPU.LOONGARCH64;
2023-09-26 17:31:16 +08:00
+
} else if (Util.equalsIgnoreCase("mips64", archString, LOCALE) || Util.equalsIgnoreCase("mips64el", archString, LOCALE)) {
return CPU.MIPS64EL;
2023-05-16 20:40:59 +08:00
}
diff --git a/src/main/java/com/kenai/jffi/internal/StubLoader.java b/src/main/java/com/kenai/jffi/internal/StubLoader.java
2023-09-26 17:31:16 +08:00
index 77da24d..d8af032 100644
2023-05-16 20:40:59 +08:00
--- a/src/main/java/com/kenai/jffi/internal/StubLoader.java
+++ b/src/main/java/com/kenai/jffi/internal/StubLoader.java
2023-09-26 17:31:16 +08:00
@@ -142,6 +142,8 @@ public class StubLoader {
2023-05-16 20:40:59 +08:00
ARM,
/** AArch64 */
AARCH64,
2023-09-26 17:31:16 +08:00
+ /** LoongArch64 */
+ LOONGARCH64,
/** MIPS 64-bit little endian */
MIPS64EL,
2023-05-16 20:40:59 +08:00
/** Unknown CPU */
2023-09-26 17:31:16 +08:00
@@ -208,6 +210,8 @@ public class StubLoader {
2023-05-16 20:40:59 +08:00
return CPU.ARM;
} else if (Util.equalsIgnoreCase("aarch64", archString, LOCALE)) {
return CPU.AARCH64;
+ } else if (Util.equalsIgnoreCase("loongarch64", archString, LOCALE)) {
+ return CPU.LOONGARCH64;
2023-09-26 17:31:16 +08:00
} else if (Util.equalsIgnoreCase("mips64", archString, LOCALE) || Util.equalsIgnoreCase("mips64el", archString, LOCALE)) {
return CPU.MIPS64EL;
2023-05-16 20:40:59 +08:00
--
2.33.0