Gentoo Archives: gentoo-alt

From: Michael Haubenwallner <haubi@g.o>
To: gentoo-alt@l.g.o
Subject: [gentoo-alt] [PREFIX] switching to "native" style shared libraries on AIX
Date: Thu, 13 Mar 2008 14:32:44

(sorry for that long mail - yes, this topic is complex)

First to say: The "native" style of shared libraries on AIX is to pack
some "shared object" into an "archive library" [1].


Using this style, it is possible to have something like what is called
'soname' in most ELF systems.

Currently, most packages create such native style shared libs on AIX in
prefix, while some (system-) packages do not (ncurses, readline, zlib,
bzip2, libperl/perl, openssl, apr/apr-util/subversion, ...).

< the most important in this mail >

        Unfortunately there is no way (currently?) for that system
        packages to _switch_ from linux- to aix-style shared libs on an
        _existing_ AIX EPREFIX for various reasons.

</ the most important in this mail >

Well, AIX (since AIX 4.2) _can_ use '', when using linker flag
'-brtl' (feature called "runtime linking")[1], but then there is no such
'soname'-like mechanism, which is a real issue when it comes to major
gcc upgrades, as we will need to provide gcc libs in a standard location
because of minor gcc upgrades [2].


Thus gcc provides its "shared object" named "" packed into
the "archive library" named "libstdc++.a" on AIX.
As suggested on gcc platform specific site[3], when upgrading from old
gcc, one (human, package managers) can extract "" from old
"libstdc++.a", give it the F_LOADONLY flag, and pack it into the new
"libstdc++.a", to keep binaries built with old gcc still running,
because they have recorded to load "" from "libstdc++.a",
while linking new binaries ignore "" (because of the
F_LOADONLY flag) and link against "".


OTOH, we eventually want runtime linking like known from linux and other
System-V *nices[1]. I've seen somewhere (can't remember exactly), that
gcc's exception handling works better with runtime linking enabled in
some corner cases. So the ld-wrapper used in prefix currently enables
'-brtl' internally, but this may change in the future...

But now, why do packages not create shared library in "native" style ?

Thing is, *libtool* _does_ create "native" style aix shared libraries
(provided that shared libraries are to be created at all) when there is
_no_ "-brtl" or "-Wl,-brtl" found in LDFLAGS. libtool does not build the
static objects then, because having both static and shared objects of
the same sourcecode in the archive library is a bad idea. I've
experienced that shared object won't be used when there is a static
object providing the required symbols in the same archive library - but
don't trust me on this one.

And yes, gcc uses libtool to create its libraries.

Now, the packages _not_ using libtool mostly create along
with the symlinks and, as they do on linux.
These packages need to be fixed/ported.

Additionally, there are some packages putting "-brtl" or "-Wl,-brtl"
into LDFLAGS, resulting in libtool also creating with
symlinks. The easiest way here eventually is to have libtool ignoring
-brtl in LDFLAGS for whether to create aix style shared libs.

Will create a tracker bug on this issue.

Michael Haubenwallner
Gentoo on a different level

gentoo-alt@l.g.o mailing list