AIX: Use archives for shared libraries
On UNIX platforms a "shared object" is a binary object that can be linked by another binary and loaded at runtime. On most UNIX platforms shared objects are stored as standalone files with a
.so extension and called "shared libraries". Dependent binaries record a "soname" for each shared object on which they depend, e.g.
libfoo.so (possibly with a version suffix but that is not relevant here). At runtime the dynamic loader searches for a file on disk with the corresponding soname.
On AIX, binaries record two fields for each shared object dependency: a "base" file name and an optional "member" name. One may use
dump -H to see the recorded dependencies of a real binary. There are two cases:
- The "base" file name may refer directly to a shared object file name (e.g.
libfoo.so), in which case the "member" field is unused/empty. This is much like the simple "soname" used on other UNIX platforms. At runtime the dynamic loader searches for the shared object file on disk.
- The "base" file name may refer to a library archive file (e.g.
libfoo.a) that contains a shared object, in which case the "member" field is the name of the shared object within the archive (e.g.
foo.so, or even just
foo.oso long as
dump -ovshows a
SHROBJflag). At runtime the dynamic loader searches for the base file name of each dependency and then finds the required shared object member in the archive.
AIX documentation distinguishes between a "shared object" and a "shared library", with the latter being a library archive (
.a) file containing a shared object. On AIX a shared library archive file may contain multiple shared objects, e.g. for different groups of symbols or even for distinct architectures.
CMake currently implements shared libraries on AIX by using shared object (
.so) files directly on disk due to consistency with other platforms. We should consider instead implementing them as shared library (
.a) archive files.