[jdk11u] RFR: 8275703: System.loadLibrary fails on Big Sur for libraries hidden from filesystem

Matthias Baesken mbaesken at openjdk.java.net
Tue Mar 8 12:45:10 UTC 2022


On Tue, 8 Mar 2022 07:59:10 GMT, Goetz Lindenmaier <goetz at openjdk.org> wrote:

> I backport this for parity with 11.0.15-oracle.
> 
> The code touched was completely reworked in jdk15 by "8228336: Refactor native library loading implementation"
> 
> make/test/JtregNativeJdk.gmk
> Trivial resolve due to context.
> 
> src/hotspot/share/prims/jvm.cpp
> Applies clean, but does not compile.
> I removed "log_info(library)("Failed to load library %s", name);"
> Logging was only added to this file in jdk15 with "8187305: Add logging for shared library loads/unloads"
> 
> Changes to 
> src/java.base/macosx/classes/jdk/internal/loader/ClassLoaderHelper.java
> applied to 
> src/java.base/macosx/classes/java/lang/ClassLoaderHelper.java
> Fits well.
> 
> Changes to 
> src/java.base/share/classes/jdk/internal/loader/NativeLibraries.java
> applied to class NativeLibrary in java/lang/ClassLoader.java.
> I had to modify the code.
> 
> Changes to 
> src/java.base/share/native/libjava/NativeLibraries.c
> applied to 
> src/java.base/share/native/libjava/ClassLoader.c
> Fits acceptable.
> 
> Changes to
> src/java.base/unix/classes/jdk/internal/loader/ClassLoaderHelper.java
> applied to 
> src/java.base/unix/classes/java/lang/ClassLoaderHelper.java
> Fits well.
> 
> Changes to
> src/java.base/windows/classes/jdk/internal/loader/ClassLoaderHelper.java
> applied to 
> src/java.base/windows/classes/java/lang/ClassLoaderHelper.java
> Fits well.
> 
> SAP testing passed.

Looks good mostly.
Minor comments (leave it to you if you want to add)


src/hotspot/share/prims/jvm.cpp

Instead of

log_info(library)("Failed to load library %s", name);

we could use

log_info(os)("Failed to load library %s", name);


The comment from

src/java.base/share/classes/jdk/internal/loader/NativeLibraries.java

* Load a native library from the given file.  Returns null if the given
* library is determined to be non-loadable, which is system-dependent.

could be added to

src/java.base/share/classes/java/lang/ClassLoader.java

at an approriate place.

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

Marked as reviewed by mbaesken (Reviewer).

PR: https://git.openjdk.java.net/jdk11u/pull/30


More information about the jdk-updates-dev mailing list