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
Message-Id: 1205418741.18170.73.camel@sapc154.salomon.at
1 Hi,
2
3 (sorry for that long mail - yes, this topic is complex)
4
5 First to say: The "native" style of shared libraries on AIX is to pack
6 some "shared object" into an "archive library" [1].
7
8 [1] http://www.ibm.com/developerworks/aix/library/au-gnu.html#N101D9
9
10 Using this style, it is possible to have something like what is called
11 'soname' in most ELF systems.
12
13 Currently, most packages create such native style shared libs on AIX in
14 prefix, while some (system-) packages do not (ncurses, readline, zlib,
15 bzip2, libperl/perl, openssl, apr/apr-util/subversion, ...).
16
17 < the most important in this mail >
18
19 Unfortunately there is no way (currently?) for that system
20 packages to _switch_ from linux- to aix-style shared libs on an
21 _existing_ AIX EPREFIX for various reasons.
22
23 </ the most important in this mail >
24
25 Well, AIX (since AIX 4.2) _can_ use 'libX.so', when using linker flag
26 '-brtl' (feature called "runtime linking")[1], but then there is no such
27 'soname'-like mechanism, which is a real issue when it comes to major
28 gcc upgrades, as we will need to provide gcc libs in a standard location
29 because of minor gcc upgrades [2].
30
31 [2] http://archives.gentoo.org/gentoo-alt/msg_4284d1915556e743727e7621f13ef5b9.xml
32 http://thread.gmane.org/gmane.linux.gentoo.alt/3430
33
34 Thus gcc provides its "shared object" named "libstdc++.so.6" packed into
35 the "archive library" named "libstdc++.a" on AIX.
36 As suggested on gcc platform specific site[3], when upgrading from old
37 gcc, one (human, package managers) can extract "libstdc++.so.5" from old
38 "libstdc++.a", give it the F_LOADONLY flag, and pack it into the new
39 "libstdc++.a", to keep binaries built with old gcc still running,
40 because they have recorded to load "libstdc++.so.5" from "libstdc++.a",
41 while linking new binaries ignore "libstdc++.so.5" (because of the
42 F_LOADONLY flag) and link against "libstdc++.so.6".
43
44 [3] http://gcc.gnu.org/install/specific.html#x-ibm-aix
45
46 OTOH, we eventually want runtime linking like known from linux and other
47 System-V *nices[1]. I've seen somewhere (can't remember exactly), that
48 gcc's exception handling works better with runtime linking enabled in
49 some corner cases. So the ld-wrapper used in prefix currently enables
50 '-brtl' internally, but this may change in the future...
51
52 But now, why do packages not create shared library in "native" style ?
53
54 Thing is, *libtool* _does_ create "native" style aix shared libraries
55 (provided that shared libraries are to be created at all) when there is
56 _no_ "-brtl" or "-Wl,-brtl" found in LDFLAGS. libtool does not build the
57 static objects then, because having both static and shared objects of
58 the same sourcecode in the archive library is a bad idea. I've
59 experienced that shared object won't be used when there is a static
60 object providing the required symbols in the same archive library - but
61 don't trust me on this one.
62
63 And yes, gcc uses libtool to create its libraries.
64
65 Now, the packages _not_ using libtool mostly create lib.so.1.2.3 along
66 with the symlinks libX.so.1 and libX.so, as they do on linux.
67 These packages need to be fixed/ported.
68
69 Additionally, there are some packages putting "-brtl" or "-Wl,-brtl"
70 into LDFLAGS, resulting in libtool also creating libX.so.1.2.3 with
71 symlinks. The easiest way here eventually is to have libtool ignoring
72 -brtl in LDFLAGS for whether to create aix style shared libs.
73
74 Will create a tracker bug on this issue.
75
76 /haubi/
77 --
78 Michael Haubenwallner
79 Gentoo on a different level
80
81 --
82 gentoo-alt@l.g.o mailing list

Replies