RFR: 8339480: Build static-jdk image with a statically linked launcher [v9]

Jiangli Zhou jiangli at openjdk.org
Mon Nov 4 19:08:35 UTC 2024


On Fri, 1 Nov 2024 16:25:59 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 10 commits:
> 
>  - Merge branch 'master' into static-jdk-image
>  - Fix bug in filtering out -Wl,--exclude-libs,ALL
>  - Don't hardcode server variant
>  - Setup LDFLAGS_STATIC_JDK
>  - Update GetJREPath comment and remove unnecessary JLI_IsStaticallyLinked check
>  - Add lookup asserts
>  - Remove superfluous SRC.
>  - Merge branch 'master' into static-jdk-image
>  - Makefile changes needed for static-launcher and static-jdk-image targets
>  - Incorporate changes from leyden/hermetic-java-runtime that allows running a static launcher

Fixed a typo in above comment: **does** should be **doesn't**

> I notice incremental build with your current PR does update `static-jdk/bin/java` properly. This should be fixed as well.

Should be:

I notice incremental build with your current PR doesn't update `static-jdk/bin/java` properly. This should be fixed as well.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20837#issuecomment-2455487724


More information about the core-libs-dev mailing list