RFR: 8370659: [mobile] enable static-libs-image for Android [v2]
Johan Vos
jvos at openjdk.org
Mon Jan 5 11:11:53 UTC 2026
On Mon, 22 Dec 2025 13:37:09 GMT, Julian Waters <jwaters at openjdk.org> wrote:
>> Johan Vos has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>>
>> - Merge branch 'master' into 8370659-android
>> - Changes required to compile libjvm.a and the classlibs using the latest upstream code.
>
> make/autoconf/flags-cflags.m4 line 73:
>
>> 71:
>> 72: # Debug symbols
>> 73: if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$OPENJDK_TARGET_OS" = xandroid; then
>
> What gcc flags does Android need that can't be done in the clang block?
@TheShermanTanker That's an excellent question, and I'm not happy with my answer. Unless I'm missing something, unfortunately there is no way to use different debug flags when building for target versus for build system. When compiling for target Android on a Linux host, the same set of flags are used. We use different compilers though: clang for the Android code for code that eventually will run on Android, and c for the tools that will run on the build system.
The check in flags-cflags.m4 checks for the toolchain, but the flags are also applied for code that needs to be built and executed on the build system.
> make/autoconf/flags-cflags.m4 line 435:
>
>> 433: CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
>> 434: elif test "x$OPENJDK_TARGET_OS" = xandroid; then
>> 435: CFLAGS_OS_DEF_JVM="-target aarch64-linux-android32 -DLINUX -D_ALLBSD_SOURCE -DANDROID"
>
> Interesting that -target is needed, I thought --openjdk-target would handle that. Admittedly however I'm not very experienced with clang/LLVM, my area of expertise is more related to gcc.
openjdk-target and target are different things. The target parameter here is purely for android, and it is a combination of the usual triplet with a version (32 in this case, which is not related to 32bits).
-------------
PR Review Comment: https://git.openjdk.org/mobile/pull/40#discussion_r2661126005
PR Review Comment: https://git.openjdk.org/mobile/pull/40#discussion_r2661130939
More information about the mobile-dev
mailing list