RFR: 8347755: Support static library in jmod [v6]

Jiangli Zhou jiangli at openjdk.org
Mon May 19 22:33:12 UTC 2025


On Fri, 14 Mar 2025 04:42:49 GMT, Henry Jen <henryjen at openjdk.org> wrote:

>> This PR add --static-libs option to the jmod tool, it's basically mirroring --libs option to support adding a new section of static archive into the jmod file under the new section `static-lib`.
>> 
>> The JMOD magic header contains a MAJOR and MINOR version, we bump up the MINOR version if the --static-libs option is specified; otherwise, keep the MINOR version as 1. This allow created JMOD file without the newly supported static-lib section to continue be consumed by earlier version of jmod tool.
>> 
>> Also fix the formatting for _hermetic_jdk_jimage_offset, which is a julong(uint64_t) as unsigned long long on MacOS, thus need to use %llu.
>
> Henry Jen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add hotspot static libs to java.base-static-jmod

I'm looking to using the static libs from the static jmods for linking launcher executable. I just pushed https://github.com/openjdk/leyden/commit/664d3070dcc8040dacbb2adc20245e9cd580fe65 with following changes for static jmods. Do we want to start review process for all changes to the leyden/hermetic-java-runtime branch now?

- Build static-jmods as a dependency for static-jdk.
- Copy the static jmods into static-jdk/jmods, instead of copying from the regular JDK.

The shared libraries (`.so`) are still included in the static jmods. I think only the static libraries (`.a`) are needed in the static jmods.

$ jmod list ./linux-x86_64-server-fastdebug/images/static-jdk/jmods/java.base.jmod | grep libjvm
lib/server/libjvm.so
static-lib/libjvm.a

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

PR Comment: https://git.openjdk.org/leyden/pull/46#issuecomment-2892431418


More information about the leyden-dev mailing list