bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

runtime linking, soname: AIX versus SysV


From: Michael Haubenwallner
Subject: runtime linking, soname: AIX versus SysV
Date: Wed, 15 Oct 2008 21:27:51 +0200

Hi,

Currently on AIX, when creating shared libraries with libtool, by
default these are created as "shared objects" packed into an "archive
library", providing an equivalent of the "soname" feature by giving that
"shared object" the "soname" as filename. The static objects are not
built in this case.
This is ok so far, and the "soname" equivalent works.

But these "shared objects" are created with "runtime linking" disabled,
which was the only choice for AIX before AIX4.2 AFAIK.

But now there is the option to pass "-brtl" linker flag to enable the
"runtime linking" feature, which is SysV's default AFAICT.
In this case, libtool leaves the "shared objects" as plain files, but
with symlinks like known from Linux (and others). Additionally, the
"static objects" are built and packed into the "archive library".

Although there are symlinks, this does completely disable any form of
the "soname" feature, as AIX does not support setting a "soname" inside
"shared objects" directly, rendering those symlinks useless.

      * Did I understand correctly that one of libtool's goals is to
        provide SysV-like shared library behaviour as much as possible
        on any platform?

      * If that is true, shouldn't the default then be to have runtime
        linking _enabled_ on AIX >= 4.2, while keeping the "soname"
        equivalent ("shared objects" inside "archive libraries") enabled
        too?

This would imply to create "shared objects" with the "-G" and
executables with the "-brtl" linker flag.
If necessary, subsequent "-bnortl" can disable "runtime linking".

Using "-G" also would "--allow-undefined", which can be turned off by a
subsequent "-bernotok" linker flag to force "--no-undefined".

OTOH, code that relies on "--allow-undefined" being the default IMO is
bad design, but this seems to be for historical reasons. Ideally,
"--no-undefined" should be the default, but that would touch (almost)
all platforms libtool supports and make it incompatible with earlier
libtool versions. Or am I completely wrong here?

For dynamically loading "shared objects": It is possible to load "shared
objects" from inside an "archive library", using the RTLD_MEMBER flag
and specifying the archive member, for example:

        dlopen("libclntsh.a(shr.o)", RTLD_NOW | RTLD_MEMBER)

But I've not found RTLD_MEMBER being used anywhere in libltdl...

Thoughts?

Thanks!
/haubi/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]