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

Magnus Ihse Bursie ihse at openjdk.org
Tue Sep 3 13:02:55 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).

@jianglizhou Can you please check if there are any other contributors that should be acknowledged?

The `static-jdk` image is enough to run a simple HelloWorld java program; however it cannot yet run JTReg tests. The reason for this is, afaict, that the javac launcher is missing. I am planning to examine if it is possible to add a small shim `javac` launcher that calls the static `java` with the proper main class. (And similarly for the other launchers.) The goal here must, after all, be that we should be able to run the normal jtreg tests on the `static-jdk` image.

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

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


More information about the build-dev mailing list