On Tue, 18 Jun 2024 17:57:29 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:
>> Magnus Ihse Bursie has updated the pull request with a new target base due >> to a merge or a rebase. The incremental webrev excludes the unrelated >> changes brought in by the merge/rebase. The pull request contains seven >> additional commits since the last revision: >> >> - Merge branch 'master' into static-linking-progress >> - Merge branch 'master' into static-linking-progress >> - Move the exported JVM_IsStaticallyLinked to a better location >> - Use runtime lookup of static vs dynamic instead of #ifdef STATIC_BUILD >> - Copy fix for init_system_properties_values on linux >> - Make sure we do not try to build static libraries on Windows >> - 8333268: Fixes for static build > > src/hotspot/os/linux/os_linux.cpp line 605: > >> 603: >> 604: // Get rid of /{client|server|hotspot}, if binary is libjvm.so. >> 605: // Or, cut off /<binary_name>. > > @jianglizhou This code is based on changes in the Hermetic Java repo, but I > do not fully understand neither the comment nor what the purpose is. If you > could explain this a bit I'd be grateful. The specific related commit in the hermetic Java branch is https://github.com/openjdk/leyden/commit/53aa8f0cf418ab5f435a4b9996c7754fb8505d4b. The change in os_linux.cpp here is to make sure that the libjvm.so related path manipulation is conditionally done only. The check at line 599 looks for "/libjvm.so" substring, so we only chop off (`*pslash = `\0` at line 601) that part when necessary. In the static JDK case, there is no `libjvm.so` and the path string is `<jdk_path>/bin/javastatic`, which should not be affected. Otherwise, it could fail. I found the code was not very easy to follow when running into problems and fixing for static support. So I added a bit more comments in the code here. The comment above about `/{client|server|hotspot}` was there originally. I think we no longer have those directories. We can cleanup that later, since it needs some more testing. @magicus, thanks a lot for extracting/reworking/cleaning-up the static Java changes from the hermetic Java branch. That's a substantial amount of work! I have one quick comment about the removal of `STATIC_LIB_EXCLUDE_OBJS` changes. Will post it as separate comment for the related code. I'll also look closely of the vm & jdk changes and compare those with the changes in the hermetic Java branch this week. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19478#discussion_r1648283151