Skip to content

Commit

Permalink
openjdk-17: Add workaround for tagged pointers
Browse files Browse the repository at this point in the history
on Android 12.

Co-authored-by: dev-bz <32380878+dev-bz@users.noreply.github.com>
  • Loading branch information
xtkoba and dev-bz committed May 4, 2022
1 parent ac6b027 commit a3fdaf3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/openjdk-17/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Java development kit and runtime"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=17.0
TERMUX_PKG_REVISION=19
TERMUX_PKG_REVISION=20
TERMUX_PKG_SRCURL=https://github.com/termux/openjdk-mobile-termux/archive/ec285598849a27f681ea6269342cf03cf382eb56.tar.gz
TERMUX_PKG_SHA256=d7c6ead9d80d0f60d98d0414e9dc87f5e18a304e420f5cd21f1aa3210c1a1528
TERMUX_PKG_DEPENDS="freetype, giflib, libandroid-shmem, libandroid-spawn, libiconv, zlib, xorgproto, libx11, libxcursor, libxext, cups, fontconfig, libjpeg-turbo, libpng, libxrender, libxtst, libxrandr, libxt, libxi"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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 @@
@@ -54,6 +54,32 @@
#include "java.h"
#include "jni.h"

Expand All @@ -11,6 +11,14 @@ diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/na
+static void android_disable_tags() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ if (android_get_device_api_level() >= 31) {
+ int (*mallopt_func)(int, int) = dlsym(lib_handle, "mallopt");
+ if (mallopt_func) {
+ mallopt_func(M_BIONIC_SET_HEAP_TAGGING_LEVEL, 0);
+ }
+ return;
+ }
+ /* android_get_device_api_level() < 31 */
+ 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;
Expand Down

0 comments on commit a3fdaf3

Please sign in to comment.