RFR: JDK-8319516 - Native library suffix impact on the library loading in AIX- Java Class Loader [v8]

Suchismith Roy sroy at openjdk.org
Thu Apr 4 09:44:11 UTC 2024


On Wed, 3 Apr 2024 07:35:46 GMT, Suchismith Roy <sroy at openjdk.org> wrote:

>> Hello @suchismith1993,
>> 
>>> > I adjust the comments which also answer your question. Please add an AIX-only test to verify this behavior.
>>> 
>>> By test you mean provide the use case for pure .a files ?
>> 
>> In the JDK repo, changes like these are backed by jtreg tests https://openjdk.org/guide/#jtreg. So for this change, you would need to add a jtreg test which only runs on AIX (the jtreg documentation explains how to do that) and will exercise the `System.loadLibrary` call for a AIX specific library and verify that the library can be loaded as per the expectations that are set in the changes proposed and finalized in this PR.
>> 
>> For example, the test should verify that, after the changes proposed in this PR, calling `System.loadLibrary(<libname>)` on AIX will load from `<libname>.a` if `<libname>.so` is absent.
>> 
>> For reference, you can take a look at the existing tests for loadLibrary in the `test/jdk/java/lang/RuntimeTests/loadLibrary` directory.
>
>> test/jdk/java/lang/RuntimeTests/loadLibrary
> 
> I see. Thank you. Got to check some test cases files and how they are structured. 
> For this case, i feel the use case would be to have a pure .a file. Usually there is not such pure .a files that comes packaged with the OS. They are provided by some applications. So i am not sure how i can make the tests consistent for such cases. 
> Do you have any suggestions here ?  We are anyways passing it down to the hotspot code , which is taking care of it.

> Hello @suchismith1993,
> 
> > Usually there is not such pure .a files that comes packaged with the OS. They are provided by some applications. So i am not sure how i can make the tests consistent for such cases.
> > Do you have any suggestions here ?
> 
> Within the JDK repo, some tests require test specific native libraries (like in your case here). It appears that the JDK build infrastructure has ability to compile native code (`foo.c` for example) into a native library. However that build infrastructure doesn't appear to be flexible enough to support the case where you would have to run AIX specific commands to generate a `.a` file. So the approach of generating a test specific `.a` file doesn't look promising right now (it could still be possible, but I don't know how big a build change that would require).
> 
> So taking a step back - I see that https://bugs.openjdk.org/browse/JDK-8313616 introduced the ability to dealing with `.a` files on AIX from within the hotspot area. In that commit https://github.com/openjdk/jdk/pull/15204/files I see that there are references to a couple of `.a` files - for example `libodm.a` and `libperfstat.a`. Are those `.a` expected to be present on certain AIX systems? Perhaps your new test could use either of those in the test? There was also a mention of `libclang.a` on AIX, previously in this discussion. Maybe that could be used in the test?

I found libperfstat as the only example that is purely an archive files as part of AIX, after trying out multiple archives under /usr/lib. 
I am facing an issue to run the test ,but unable to set the library path to /usr/lib. I see the existing test case has libawt as part of jdk itself . Can i set -Djava.library.path while running jtreg test case ?

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

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


More information about the core-libs-dev mailing list