RFR: 8347755: Support static library in jmod [v5]
Henry Jen
henryjen at openjdk.org
Thu Mar 13 17:58:04 UTC 2025
On Thu, 13 Mar 2025 17:46:43 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>
> - Merge
> - Support `make static-jmods` to create static jmods
> - support major version validation
> - Update jmod.md
> - Use JULONG_FORMAT_X to suit various platforms
> - Fix julong format on MacOS
> - Add --static-libs to jmod
Latest commit to support creating of static-jmods with `make static-jmods`, thanks @magicus for help.
Result on MacOS,
ls -l build/macosx-x86_64-server-release/images/static-jmods
total 184152
-rw-r--r-- 1 hjen staff 21778174 Mar 13 10:35 java.base.jmod
-rw-r--r-- 1 hjen staff 140500 Mar 13 10:35 java.compiler.jmod
-rw-r--r-- 1 hjen staff 58934 Mar 13 10:35 java.datatransfer.jmod
-rw-r--r-- 1 hjen staff 16688299 Mar 13 10:35 java.desktop.jmod
-rw-r--r-- 1 hjen staff 68824 Mar 13 10:35 java.instrument.jmod
...
-rw-r--r-- 1 hjen staff 49946 Mar 13 10:35 jdk.xml.dom.jmod
-rw-r--r-- 1 hjen staff 112583 Mar 13 10:35 jdk.zipfs.jmod
./build/macosx-x86_64-server-release/jdk/bin/jmod list build/macosx-x86_64-server-release/images/static-jmods/java.base.jmod | grep static-lib
static-lib/libjava.a
static-lib/libjimage.a
static-lib/libjli.a
static-lib/libjsig.a
static-lib/libnet.a
static-lib/libnio.a
static-lib/libosxsecurity.a
static-lib/libsyslookup.a
static-lib/libverify.a
static-lib/libzip.a
static-lib/module-included-libs.txt
-------------
PR Comment: https://git.openjdk.org/leyden/pull/46#issuecomment-2722247186
More information about the leyden-dev
mailing list