RFR: 8339480: Build static-jdk image with a statically linked launcher [v5]

Magnus Ihse Bursie ihse at openjdk.org
Tue Oct 15 18:53:15 UTC 2024


On Thu, 5 Sep 2024 20:41:35 GMT, Jiangli Zhou <jiangli at openjdk.org> wrote:

>> You are right, this is dead code. Thanks for spotting this. 
>> 
>> During my experimentation, I tried passing along LDFLAGS from the individual libraries as well, but it turned out not to be a good idea -- the way we have used them were to modify some special properties on a single dynamic library, which did not apply to the static library as a whole.
>> 
>> However, there is a risk that we in the future need to add LDFLAGS to a library that also needs to be carried over to the static launcher. If this happens, I guess we need to separate between LDFLAGS_ONLY_FOR_THIS_DLL and LDFLAGS_ALSO_FOR_STATIC_LINKING.
>
> +1 on "separate between LDFLAGS_ONLY_FOR_THIS_DLL and LDFLAGS_ALSO_FOR_STATIC_LINKING"
> 
> I think we need to get the linker flags sorted out correctly in this initial PR and make sure the needed flags (most importantly the ones used in $JVM_LDFLAGS).

After thinking a bit more on this, I concluded that we cannot automatically extract a proper set of ld flags from what's being passed to the individual libraries. The LDFLAGS needed by the monolithic static library needs to be explicitly defined. Unfortunately, most of it will be a copy of what is already duplicated across JVM_LDFLAGS, LDFLAGS_JDKLIB and LDFLAGS_JDKEXE. :-( But cleaning that mess upp requires a separate PR.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1801756571


More information about the build-dev mailing list