#3739: Support aarch64 natives
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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" ) );
|
||||
}
|
||||
}
|
||||
|
BIN
native/src/main/resources/native-cipher-arm.so
Executable file
BIN
native/src/main/resources/native-cipher-arm.so
Executable file
Binary file not shown.
BIN
native/src/main/resources/native-compress-arm.so
Executable file
BIN
native/src/main/resources/native-compress-arm.so
Executable file
Binary file not shown.
Reference in New Issue
Block a user