RFR: JDK-8320005 : Allow loading of shared objects with .a extension on AIX [v9]

Thomas Stuefe stuefe at openjdk.org
Fri Jan 26 08:23:40 UTC 2024


On Thu, 25 Jan 2024 11:04:03 GMT, Suchismith Roy <sroy at openjdk.org> wrote:

> > For me the unresolved question is still:
> > 
> > * do we want an unconditional load of *.a for a given *.so (have yet to see any documentation for this a-file duality)
> 
> Yes. The documentation link - https://www.ibm.com/docs/en/aix/7.3?topic=memory-shared-objects-run-time-linking The text **In dynamic mode, input files specified with the -l flag may end in .so, as well as in .a. That is, a reference to -lfoo is satisfied by the first libfoo.so or libfoo.a found in any of the directories being searched. Dynamic mode is in effect by default unless the -bstatic option is used.**
> 
> https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command
> 
> Archive files are composite objects, which usually contain import files and object files, including shared objects. If an archive file contains another archive file or a member whose type is not recognized, the ld command issues a warning and ignores the unrecognized member. If an object file contained in an archive file has the F_LOADONLY bit set in the XCOFF header, the ld command ignores the member. This bit is usually used to designate old versions of shared objects that remain in the archive file to allow existing applications to load and run. New applications link with the new version of the shared object, that is, another member of the archive.

Excellent, thank you.

> 
> > * if we do, do we want that to be bidirectional? Someone specifies *.a, do we want to attempt to load *.so?
> 
> Considering the different scenarios, loading .a after .so failure should suffice. I got a chance to look at the right file in OpenJ9-omr ,which has a native code which does an attempt to load archive files after trying to load .so files. This code was always there and it explains why the issue did not occur in Semeru, which is derived from this repository.

Okay. We don't have to be better than J9 then. If they do it, we should too.

So, for the following input, we do:

"library.so" -> load "library.so", then "library.a"
"library" 	 -> load "library.so", then "library.a" ?
"library.a"  -> only load "library.a" ?

(*)

> 
> > When in doubt, we should just mimic what OpenJ9 is doing on AIX. But I would like a clear documentation as a comment in os_aix.cpp explaining the logic and referencing the relevant OpenJ9 files.
> 
> Any example comment you can refer ? I mean i just mention the file name in OpenJ9 and explain the logic ? Let me know for any further clarifications

Just reference the excerpts you mentioned above, then describe your intended logic. Example:

"When loading <lib>.so, upon failure we attempt to load <lib.a>. When loading a library given without extension, ..."

Explaining the logic makes it easy to see for the casual code reader what your intent is, that you have thought of all cases (*), and makes it possible to check the coding against your intent.

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

PR Comment: https://git.openjdk.org/jdk/pull/16604#issuecomment-1911652995


More information about the serviceability-dev mailing list