RFR: 8350041: Make libstringPlatformChars support static JDK [v2]

Jiangli Zhou jiangli at openjdk.org
Thu Feb 20 23:47:10 UTC 2025


> Please review the fix to make `java/lang/String/nativeEncoding/StringPlatformChars.java` jtreg test: 
> 
> - Lookup `JNU_GetStringPlatformChars`, `JNU_ClassString` and `JNU_NewStringPlatform` dynamically
> - Remove `#include "jni_util.h"` and don't link `libstringPlatformChars.so` with `libjava.so`
> - Link with `-ldl` explicitly
> 
> The test passed on Linux, macos and Windows in GHA testing, https://github.com/jianglizhou/jdk/actions/runs/13320840902/job/37206171224

Jiangli Zhou 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 six additional commits since the last revision:

 - Skip test/jdk/java/lang/String/nativeEncoding/StringPlatformChars.java for static JDK.
 - Revert make/test/JtregNativeJdk.gmk and test/jdk/java/lang/String/nativeEncoding/libstringPlatformChars.c changes.
 - Merge branch 'master' into JDK-8350041
 - Remove 'lib' prefix from 'java.dll'.
 - Update copyright header year.
 - - Change to call JNU_GetStringPlatformChars, JNU_ClassString and JNU_NewStringPlatform
     using the function addresses obtained from lookup. This allows building libstringPlatformChars
     without explicitly linking with libjava.so (or libjava.dll).
   - Remove #include "jni_util.h".
   - Add BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libstringPlatformChars := -ldl. It's needed to
     avoid build failure if the build is configured to not allow undefined symbols in shared
     library.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/23646/files
  - new: https://git.openjdk.org/jdk/pull/23646/files/013b391b..1de95b89

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23646&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23646&range=00-01

  Stats: 7588 lines in 309 files changed: 3962 ins; 2555 del; 1071 mod
  Patch: https://git.openjdk.org/jdk/pull/23646.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23646/head:pull/23646

PR: https://git.openjdk.org/jdk/pull/23646


More information about the build-dev mailing list