RFR: 8338768: Introduce runtime lookup to check for static builds [v2]

Alan Bateman alanb at openjdk.org
Fri Aug 30 10:07:23 UTC 2024


On Wed, 21 Aug 2024 22:14:40 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> As a preparation for Hermetic Java, we need to have a way to look up during runtime if we are using a statically linked library or not.
>> 
>> This change will be the first step needed towards compiling the object files only once, and then link them into either dynamic or static libraries. (The only exception will be the linktype.c[pp] files, which needs to be compiled twice, once for the dynamic libraries and once for the static libraries.) Getting there will require further work though. 
>> 
>> This is part of the changes that make up the draft PR https://github.com/openjdk/jdk/pull/19478, which I have broken out.
>
> Magnus Ihse Bursie has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Also update build to link properly

I think the approach is pragmatic and okay. I agree it looks a bit unusual to be testing the image type at runtime but it doesn't seem to be measurable and not a concern right now. In the future, I suspect we will have many places in the libraries that will need to test this at runtime for 30+ other reasons.

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

Marked as reviewed by alanb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20666#pullrequestreview-2271829178


More information about the core-libs-dev mailing list