RFR: 8319516: AIX System::loadLibrary needs support to load a shared library from an archive object [v22]

Suchismith Roy sroy at openjdk.org
Mon Apr 15 13:30:47 UTC 2024


On Mon, 15 Apr 2024 13:00:57 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> > Thanks. I tried with a different shared object.
> 
> If you undo the changes that are being proposed in this PR in the `src/java.base/aix/classes/jdk/internal/loader/ClassLoaderHelper.java` class (only undo that class changes), then rebuild the JDK and rerun this newly introduced test, what exception/failure do you see in the test? Don't push the changes, it's merely an exercise to ascertain that the test you are introducing will indeed verify the changes that you have done to support loading library from an archive object through System.loadLibrary().

attempting to load library foobar
Exception in thread "main" java.lang.UnsatisfiedLinkError: no foobar in java.library.path: /home/hotspot/openjdk/jdk-suchi/jdk1/build/aix-ppc64-server-fastdebug/test-support/jtreg_test_jdk_java_lang_RuntimeTests_loadLibrary_aix_LoadAIXLibraryFromArchiveObject_java/scratch/0/native
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2442)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
        at java.base/java.lang.System.loadLibrary(System.java:2068)
        at LoadAIXLibraryFromArchiveObject$LoadLibraryApp.main(LoadAIXLibraryFromArchiveObject.java:67)

STDERR:
 stdout: [attempting to load library foobar
];
 stderr: [Exception in thread "main" java.lang.UnsatisfiedLinkError: no foobar in java.library.path: /home/hotspot/openjdk/jdk-suchi/jdk1/build/aix-ppc64-server-fastdebug/test-support/jtreg_test_jdk_java_lang_RuntimeTests_loadLibrary_aix_LoadAIXLibraryFromArchiveObject_java/scratch/0/native
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2442)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:916)
        at java.base/java.lang.System.loadLibrary(System.java:2068)
        at LoadAIXLibraryFromArchiveObject$LoadLibraryApp.main(LoadAIXLibraryFromArchiveObject.java:67)
]
 exitValue = 1

java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]
        at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:521)
        at LoadAIXLibraryFromArchiveObject.main(LoadAIXLibraryFromArchiveObject.java:61)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
        at java.base/java.lang.Thread.run(Thread.java:1575)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]
JavaTest Message: shutting down test

After setting loadLibraryOnlyIfPresent to true again.

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

PR Comment: https://git.openjdk.org/jdk/pull/17945#issuecomment-2056857173


More information about the core-libs-dev mailing list