#3739: Support aarch64 natives

This commit is contained in:
Outfluencer
2024-09-08 09:11:05 +10:00
committed by md_5
parent 8f8c270f3b
commit eca6090f1e
5 changed files with 48 additions and 2 deletions

View File

@@ -3,7 +3,9 @@
#include <zlib.h>
#include "shared.h"
#if !defined(__aarch64__)
#include "cpuid_helper.h"
#endif
#include "net_md_5_bungee_jni_zlib_NativeCompressImpl.h"
typedef unsigned char byte;
@@ -28,7 +30,11 @@ jint throwException(JNIEnv *env, const char* message, int err) {
}
JNIEXPORT jboolean JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_checkSupported(JNIEnv* env, jobject obj) {
return (jboolean) checkCompressionNativesSupport();
#if !defined(__aarch64__)
return (jboolean) checkCompressionNativesSupport();
#else
return JNI_TRUE;
#endif
}
void JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_reset(JNIEnv* env, jobject obj, jlong ctx, jboolean compress) {

View File

@@ -43,6 +43,7 @@ public final class NativeCode<T>
{
if ( enableNativeFlag && !loaded && isSupported() )
{
String name = this.name + ( isAarch64() ? "-arm" : "" );
String fullName = "bungeecord-" + name;
try
@@ -94,6 +95,16 @@ public final class NativeCode<T>
public static boolean isSupported()
{
return "Linux".equals( System.getProperty( "os.name" ) ) && "amd64".equals( System.getProperty( "os.arch" ) );
return "Linux".equals( System.getProperty( "os.name" ) ) && ( isAmd64() || isAarch64() );
}
private static boolean isAmd64()
{
return "amd64".equals( System.getProperty( "os.arch" ) );
}
private static boolean isAarch64()
{
return "aarch64".equals( System.getProperty( "os.arch" ) );
}
}

Binary file not shown.

Binary file not shown.