git: openjdk/leyden: hermetic-java-runtime: Add experimental native linking (for ld or lld on Linux) part. I added two experimental options to the --link-hermetic-image flag:

Jiangli Zhou jianglizhou at google.com
Thu Apr 17 22:42:33 UTC 2025


+ henry.jen at oracle.com

On Thu, Apr 17, 2025 at 9:38 AM Magnus Ihse Bursie <
magnus.ihse.bursie at oracle.com> wrote:

> On 2025-04-09 03:21, duke wrote:
>
> > - `link-command=<link_cmd>`: Specify the complete native linking command
> >
> > - `pre-linked-exe=<pre_linked_launcher_executable>`: Specify the
> prelinked launcher executable, no native linking is performed in this case
> >
> > If the native linking command is specified via the
> `link-command=<link_cmd>` option (see below example), jlink invokes the
> native linker and performs the linking step. It finds the output file
> name/path from the native linking command and the output file is used to
> create the final hermetic Java image.
> > ```
> > jlink --hermetic --link-hermetic-image link-command="/usr/bin/g++ ..."
> ...
>
> Is the plan here to generate this link command line in the build system?
> The example you give seem to use our standard flags...
>

The native linking plugin (
https://github.com/openjdk/leyden/blob/hermetic-java-runtime/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/LinkHermeticImagePlugin.java,
plan to rename) can construct the linking command with the collected JDK
static libraries and their associated linker flags that the static .jmods (
https://github.com/openjdk/leyden/pull/46 from henry.jen@ will provide
static .jmod) provide, in addition to user provided flags/objects/etc. Each
JDK static library associated jlinker flags would be coming from the JDK
build system. I see you mentioned using "pkg-config" for linking flags with
JDK static libraries in
https://github.com/openjdk/leyden/pull/46#issuecomment-2725408153. Would
that be one "pkg-config" for each static .jmod?

Thanks,
Jiangli


> /Magnus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/leyden-dev/attachments/20250417/8b361c1e/attachment.htm>


More information about the leyden-dev mailing list