RFR: 8339480: Build static-jdk image with a statically linked launcher
Magnus Ihse Bursie
ihse at openjdk.org
Thu Sep 5 09:54:53 UTC 2024
On Wed, 4 Sep 2024 23:03:23 GMT, Jiangli Zhou <jiangli 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).
>
> make/StaticLibs.gmk line 74:
>
>> 72: BROKEN_STATIC_LIBS += awt dt_shmem dt_socket javaaccessbridge
>> 73: # These libs are dependent on any of the above disabled libs
>> 74: BROKEN_STATIC_LIBS += fontmanager jawt lcms net nio
>
> Which specific dependent cause these libs being excluded? In https://github.com/openjdk/leyden/tree/hermetic-java-runtime/ branch, these JDK libs (except `libjawt.a`) are statically linked into `javastatic`.
Well, but your proof-of-concept only supports clang on linux, where you have enabled symbol hiding.
Our conclusion in the zoom talks was that we should strive for getting a static launcher build pushed into mainline before we have full and proper support for symbol hiding on all platforms.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1745161079
More information about the core-libs-dev
mailing list