RFR: 8339480: Build static-jdk image with a statically linked launcher
Erik Joelsson
erikj at openjdk.org
Tue Sep 3 20:01:21 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).
make/ModuleWrapper.gmk line 59:
> 57: endif
> 58: endif
> 59:
This part looks a bit convoluted. It would be nice with a comment explaining what it does, where `$($(MODULE)_JDK_LIBS)` is coming from and what consumes the module-libs.txt.
make/StaticLibs.gmk line 171:
> 169:
> 170: $(eval $(call SetupCopyFiles, copy-static-launcher, \
> 171: SRC := $(dir $(JAVA_LAUNCHER)), \
If only copying a single file, this becomes the default value for SRC, so no need to specify it.
make/common/JdkNativeCompilation.gmk line 310:
> 308: $$(MODULE)_JDK_LIBS += $$($1_NAME)
> 309: endif
> 310: endif
Same, here as in ModuleWrapper.gmk, I think we need a comment explaining how this is consumed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1742601500
PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1742500522
PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1742605313
More information about the build-dev
mailing list