RFR: 8339480: Build static-jdk image with a statically linked launcher
Jiangli Zhou
jiangli at openjdk.org
Thu Sep 5 20:43:52 UTC 2024
On Thu, 5 Sep 2024 10:03:19 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
>> make/StaticLibs.gmk line 118:
>>
>>> 116: OPTIMIZATION := HIGH, \
>>> 117: STATIC_LAUNCHER := true, \
>>> 118: LDFLAGS := $(JAVASTATIC_LINK_LDFLAGS), \
>>
>> I could be missing something, but I don't see where is $JAVASTATIC_LINK_LDFLAGS defined.
>>
>> On a related notes, I think we need to include $JVM_LDFLAGS when linking the static "java". See https://bugs.openjdk.org/browse/JDK-8339522?focusedId=14702923&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-14702923.
>
> 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).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20837#discussion_r1746133505
More information about the core-libs-dev
mailing list