RFR: 8339480: Build static-jdk image with a statically linked launcher
Jiangli Zhou
jiangli at openjdk.org
Thu Sep 5 00:05:50 UTC 2024
On Tue, 3 Sep 2024 12:50:01 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
> As a prerequisite for Hermetic Java, we need a statically linked `java` launcher. It should behave like the normal, dynamically linked `java` launcher, except that all JDK native libraries should be statically, not dynamically, linked.
>
> This patch is the first step towards this goal. It will generate a `static-jdk` image with a statically linked launcher. This launcher is missing several native libs, however, and does therefore not behave like a proper dynamic java. One of the reasons for this is that local symbol hiding in static libraries are not implemented yet, which causes symbol clashes when linking all static libraries together. This will be addressed in an upcoming patch.
>
> All changes in the `src` directory are copied from, or inspired by, changes made in [the hermetic-java-runtime branch in Project Leyden](https://github.com/openjdk/leyden/tree/hermetic-java-runtime).
src/hotspot/share/classfile/classLoader.cpp line 953:
> 951: assert(CanonicalizeEntry == nullptr, "should not load java library twice");
> 952: if (is_vm_statically_linked()) {
> 953: CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::lookup_function("JDK_Canonicalize"));
Can you add an assert to make sure `CanonicalizeEntry` is not NULL?
src/hotspot/share/classfile/classLoader.cpp line 969:
> 967:
> 968: if (is_vm_statically_linked()) {
> 969: JImageOpen = CAST_TO_FN_PTR(JImageOpen_t, os::lookup_function("JIMAGE_Open"));
It might be good to assert these are not NULL as well.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1744635408
PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1744635916
More information about the build-dev
mailing list