RFR: 8352689: Allow for hash sum overrides when linking from the run-time image [v2]

Christoph Langer clanger at openjdk.org
Wed Mar 26 08:31:10 UTC 2025


On Tue, 25 Mar 2025 17:43:07 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> Please review this enhancement which adds a hidden `jlink` option `--sha-overrides` that can be used to provide alternative hash sums for files in an image. Please see the bug for use-cases as to why this is needed. This patch allows for the `--sha-overrides` option to be either specified multiple times or separated by a comma to list multiple hash sum overrides. Alternatively when starting with the `@` character the override options come from a file. The format is the same: `<module>|<file-path>|<sha>` triplets, either on the command line or in a file (one per line).
>> 
>> The added, linux only, test uses `objcopy` to fully strip `libjvm.so` of its symbols with the assumption that this would change the hash sum of the resulting file. Then, a link from the run-time image is being attempted with the added option `--sha-overrides=java.base|lib/server/libjvm.so|<new-sha-sum>` and verifies the link succeeds.
>> 
>> Having something like that is useful when it gets combined with e.g. `--save-jlink-arg-files` to produce a `jlink` which works out of the box on say JDK builds that modify binaries due to some debug symbols handling outside the JDK builds' control. 
>> 
>> While using `--ignore-modified-runtime` is an option that is sub-optimal as that would spit out many warnings in the RPM build case, where the user wouldn't control that RPM build to begin with.
>> 
>> Testing:
>> - [x] GHA
>> - [x] Some manual tests together with [JDK-8352692](https://bugs.openjdk.org/browse/JDK-8352692) on some JEP 493 enabled builds.
>> - [x] `jlink` jtreg tests.
>> 
>> Thoughts?
>
> Severin Gehwolf has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Copyright updates
>  - Allow for ${java.home} substitution when \@file is being passed
>    
>    Also refactor the tests. One using the CLI, the other using
>    the @file-base version of the option.

Still good.

test/jdk/tools/jlink/runtimeImage/ModifiedFilesWithShaOverrideTest.java line 32:

> 30:  * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g & os.family == "linux")
> 31:  * @library ../../lib /test/lib
> 32:  * @enablePreview

Do you know why @enablePreview is necessary here?

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

Marked as reviewed by clanger (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/24190#pullrequestreview-2716264326
PR Review Comment: https://git.openjdk.org/jdk/pull/24190#discussion_r2013612887


More information about the core-libs-dev mailing list