RFR: JDK-8319516 - Native library suffix impact on the library loading in AIX- Java Class Loader [v10]
Mandy Chung
mchung at openjdk.org
Thu Apr 4 17:51:14 UTC 2024
On Thu, 4 Apr 2024 11:13:43 GMT, Suchismith Roy <sroy at openjdk.org> wrote:
>> Allow support for both .a and .so files in AIX.
>> If .so file is not found, allow fallback to .a extension.
>> JBS Issue: [JDK-8319516](https://bugs.openjdk.org/browse/JDK-8319516)
>
> Suchismith Roy has updated the pull request incrementally with one additional commit since the last revision:
>
> Add jtreg test case
src/java.base/aix/classes/jdk/internal/loader/ClassLoaderHelper.java line 47:
> 45: * If loading of the given library name with ".so" suffix fails, it will attempt to load the library of
> 46: * the same name with ".a" suffix as the alternate name.
> 47: * This method simply returns null. It could implement the alternate name converting ".so" with ".a" suffix but redundant.
Formatting nit: please wrap the comment with approx same width (~80 column). Same for line 37-39.
test/jdk/java/lang/RuntimeTests/loadLibrary/LoadLibraryTestAIX.java line 28:
> 26: * @bug 8319516
> 27: * @requires os.family == "aix"
> 28: * @run main/native/othervm -Djava.library.path=/usr/lib LoadLibraryTestAIX
Suggestion:
* @run main/othervm -Djava.library.path=/usr/lib LoadLibraryTestAIX
This test does not build native library. I think it does not need "main/native"
test/jdk/java/lang/RuntimeTests/loadLibrary/LoadLibraryTestAIX.java line 31:
> 29: */
> 30:
> 31: public class LoadLibraryTestAIX {
what about `LoadAIXLibraryFromArchiveObject`?
test/jdk/java/lang/RuntimeTests/loadLibrary/LoadLibraryTestAIX.java line 33:
> 31: public class LoadLibraryTestAIX {
> 32: public static void main(String[] args) throws Exception {
> 33: String libraryName="perfstat";
Suggestion:
String libraryName = "perfstat";
test/jdk/java/lang/RuntimeTests/loadLibrary/LoadLibraryTestAIX.java line 38:
> 36: } catch (Exception e) {
> 37: throw new RuntimeException("LoadLibraryTestAIX : could not load libperfstat.a"+e);
> 38: }
Nit: the catch clause is not strictly needed. `UnsatisfiedLinkError` is an unchecked exception. The test should fail if you run it with JDK without this fix.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17945#discussion_r1552158568
PR Review Comment: https://git.openjdk.org/jdk/pull/17945#discussion_r1552146115
PR Review Comment: https://git.openjdk.org/jdk/pull/17945#discussion_r1552145197
PR Review Comment: https://git.openjdk.org/jdk/pull/17945#discussion_r1552135081
PR Review Comment: https://git.openjdk.org/jdk/pull/17945#discussion_r1552137303
More information about the core-libs-dev
mailing list