termux-packages/packages/openjdk-17/android11.patch

38 lines
1.4 KiB
Diff
Raw Normal View History

2021-07-30 11:33:56 +02:00
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/native/libjli/java.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/share/native/libjli/java.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/native/libjli/java.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/share/native/libjli/java.c 2021-07-30 15:23:39.352949077 +0300
@@ -54,6 +54,24 @@
2021-07-30 12:29:54 +02:00
#include "java.h"
#include "jni.h"
2021-07-30 11:33:56 +02:00
+#ifdef __TERMUX__
+#include <stdbool.h>
+#include <dlfcn.h>
+static void android_disable_tags() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ bool (*android_mallopt)(int opcode, void* arg, size_t arg_size) = dlsym(lib_handle, "android_mallopt");
+ if (android_mallopt) {
+ int android_malloc_tag_level = 0;
+ android_mallopt(8, &android_malloc_tag_level, sizeof(android_malloc_tag_level));
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_tags(){}
2021-07-30 11:33:56 +02:00
+#endif
+
/*
* A NOTE TO DEVELOPERS: For performance reasons it is important that
* the program image remain relatively small until after SelectVersion
@@ -252,6 +270,8 @@
2021-07-30 11:33:56 +02:00
_is_java_args = javaargs;
_wc_enabled = cpwildcard;
+ android_disable_tags();
2021-07-30 11:33:56 +02:00
+
InitLauncher(javaw);
DumpState();
if (JLI_IsTraceLauncher()) {