RFR: 8339480: Build static-jdk image with a statically linked launcher [v21]
Coleen Phillimore
coleenp at openjdk.org
Mon Dec 2 15:15:59 UTC 2024
On Tue, 26 Nov 2024 17:17:09 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).
>
> Magnus Ihse Bursie has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 25 commits:
>
> - Merge branch 'master' into static-jdk-image
> - Remove LDFLAGS_STATIC_JDK
> - Rename EXCLUDE_FROM_STATIC_LIBS to ONLY_EXPORTED, $(MODULE)_JDK_LIBS to $(MODULE)_INCLUDED_LIBS and module-libs.txt to module-included-libs.txt
> - Find LIBZIP_OBJS automatically
> - Find LIBJAVA_JPEG_OBJS automatically
> - Just exclude the a11y libraries from static builds
> - Copy debuginfo
> - Restore SetExecname in java_md.c
> - Fix incremental builds
> - Merge branch 'master' into static-jdk-image
> - ... and 15 more: https://git.openjdk.org/jdk/compare/c329f97f...8b1217a8
Hotspot code looks okay.
src/hotspot/os/linux/os_linux.cpp line 590:
> 588:
> 589: // Found the full path to the binary. It is normally of this structure:
> 590: // <jdk_path>/lib/<hotspot_variant>/libjvm.so
You could change <hotspot_variant> to server I believe, since there isn't a client (I hope) version anymore.
-------------
Marked as reviewed by coleenp (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/20837#pullrequestreview-2472978117
PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1866025164
More information about the build-dev
mailing list