Gentoo Archives: gentoo-alt

From: Michael Haubenwallner <haubi@g.o>
To: Ruud Koolen <redlizard@g.o>
Cc: gentoo-alt@l.g.o
Subject: [gentoo-alt] AIX-specific early stage3 dependencies
Date: Mon, 28 Apr 2014 08:31:15
Message-Id: 535E11C2.5070503@gentoo.org
1 Hi Ruud,
2
3 (CCing gentoo-alt, as the reasoning below is worth to be archived in the public)
4
5 On 04/28/2014 04:41 AM, Ruud Koolen wrote:
6 > Hi haubi,
7 >
8 > As part of the new-bootstrap effort I'm trying to clean up old hacks (at least
9 > in stage3) and simplify platform-specific paths. I understand most of them
10 > but there are a few aspects of which I don't properly understand what they
11 > are for. Can you clear up the aix parts of that?
12 >
13 > Specifically, configure_toolchain() lists sys-apps/aix-miscutils,
14 > sys-apps/texinfo, and sys-apps/diffutils as extra early stage3 packages, and
15 > stage3 itself builds dev-libs/libiconv to "avoid hell with shared
16 > libiconv.a"; I want to know exactly what they're used for and at which point
17 > we need it.
18 >
19 > sys-apps/aix-miscutils contains ldd and aixdll. ldd sounds like something
20 > that's not necessary in the bootstrap, but aixdll sounds like something
21 > necessary for building shared libraries. Is it? If so, does aix need it to
22 > build ANY shared library, including such things as the early iconv and
23 > ncurses?
24
25 IIRC, aixdll is needed by portage itself for these tasks:
26 *) extract the binary dependencies for preserve-libs feature
27 *) merge library archives containing shared objects - even with "aix-soname".
28
29 > I don't have a good idea of what texinfo might possibly be used for, except
30 > for makeinfo for which there is now a more general workaround in place. Is it
31 > used for anything else?
32
33 IIRC nope, makeinfo might have been the only reason.
34
35 > sys-apps/diffutils is apparently needed to work around
36 > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14251 , but I don't see how --
37 > that bug needs gnu coreutils, not diffutils. Do you know what this is for?
38
39 AFAICT, the comparison stage in gcc uses cmp. IIRC I've seen failures when that is
40 not the GNU diffutils' cmp.
41
42 > Moreover, do you know whether this workaround is still necessary for the aix
43 > versions we support?
44
45 Comment it out or drop it, and the buildbots here whill tell.
46
47 > If I understand correctly, dev-libs/libiconv is a dependency for a lot of
48 > programs, including gcc, and as such needs to be installed before gcc. This
49 > is clear. Are there any other packages in the early bootstrap that depend on
50 > it? Could it be installed immediately before gcc? I see that it was recently
51 > moved from immediately before gcc, to one of the first things in stage3. Why
52 > is this? What hell are you avoiding this way that I should retain?
53
54 Okay, you've asked: The "hell with shared libiconv.a" is this one:
55
56 *) AIX provides:
57 /usr/lib/libiconv.a[shr4.o] 32bit
58 /usr/lib/libiconv.a[shr.o] 32bit
59 /usr/lib/libiconv.a[shr4_64.o] 64bit
60
61 *) GNU libiconv eventually is installed in /opt/freeware, providing
62 /opt/freeware/lib/libiconv.a[libiconv.so.2] 32bit
63 /opt/freeware/lib/libiconv.a[libiconv.so.2] 64bit
64 /opt/freeware/lib/libiconv.a[shr4.o] 32bit (mirroring /usr/lib/libiconv.a)
65 /opt/freeware/lib/libiconv.a[shr.o] 32bit (mirroring /usr/lib/libiconv.a)
66 /opt/freeware/lib/libiconv.a[shr4_64.o] 64bit (mirroring /usr/lib/libiconv.a)
67
68 *) gcc binary install (used for bootstrap) is installed in /opt/freeware:
69 -L/opt/freeware/lib is added by gcc at linktime
70 -L/usr/lib is added by gcc at linktime
71
72 As you might notice, the FILENAME always is libiconv.a - only the shared member name varies.
73
74 For completion, a Shared Object can have an F_LOADONLY flag, meaning to be ignored by the
75 buildtime linker when it is an archive member, while the runtime linker still can use it.
76
77 The first useable (that is: either a Shared Object without the F_LOADONLY flag or a Static
78 Object) archive member, that provides any useful symbol, is used by the buildtime linker,
79 which records both the archive's file-name and the Shared Object's member-name into the
80 final binary for the runtime linker.
81
82 The runtime linker then walks through the runpath for any recorded archive file-name, to
83 load the recorded Shared Object's member-name from. Unfortunately, it does _not_ continue
84 searching for another archive file when loading from the first one found fails. This is
85 the reason why /opt/freeware/lib/libiconv.a mirrors /usr/lib/libiconv.a's Shared Objects.
86 This mirroring already is part of the GNU iconv's build system, so we don't have to care.
87
88 This actually is the "traditional" AIX way of shared library versioning.
89
90 Because of this crap, I've developed the new "aix-soname" way, using Import Files to provide
91 filename-based shared library versioning - where the archive file-name changes, while the
92 Shared Object's member-name is constant: shr.o for 32bit and shr_64.o for 64bit. As a result,
93
94 *) Prefix GNU libiconv with "aix-soname" enabled provides:
95 /Gentoo/Prefix/usr/lib/libiconv.so.2[shr.imp] "32bit" ("aix-soname" plaintext Import File)
96 /Gentoo/Prefix/usr/lib/libiconv.so.2[shr.o] 32bit (with F_LOADONLY flag set)
97 /Gentoo/Prefix/usr/lib/libiconv.so -> libiconv.so.2 (used with -brtl or -G linker flag)
98 /Gentoo/Prefix/usr/lib/libiconv.a[iconv.o] 32bit (Static Object)
99 /Gentoo/Prefix/usr/lib/libiconv.a[localcharset.o] 32bit (Static Object)
100 /Gentoo/Prefix/usr/lib/libiconv.a[relocatable.o] 32bit (Static Object)
101 /Gentoo/Prefix/usr/lib/libiconv.a[shr4.o] 32bit (mirroring /usr/lib/libiconv.a)
102 /Gentoo/Prefix/usr/lib/libiconv.a[shr.o] 32bit (mirroring /usr/lib/libiconv.a)
103
104 Now for the bootstrap problem when there is GNU libiconv available in /opt/freeware:
105
106 Bootstrap binaries are linked against libiconv.a[libiconv.so.2] from /opt/freeware/lib.
107 Additionally, we ensure that /Gentoo/Prefix/usr/lib is part of the runpath. Usually, we make
108 use of /opt/freeware/bin/gcc via /usr/bin/gcc symlink, or via /opt/freeware/bin in PATH.
109 But our bootstrap does not know anything else about /opt/freeware at all.
110
111 Now, as soon as we have emerged Prefix GNU libiconv with "aix-soname" enabled, the runtime
112 linker fails to load [libiconv.so.2] from /Gentoo/Prefix/usr/lib/libiconv.a, because GNU iconv's
113 build system only knows to mirror Shared Objects found in /usr/lib/libiconv.a.
114
115 Thus, it is important to provide "aix-soname" enabled /Gentoo/Prefix/usr/lib/libiconv.so early
116 enough, to not link against /opt/freeware/lib/libiconv.a at all by accident.
117
118 An additional reason for filename-based shared library versioning is IBM-Java:
119 When executing any system binary from within some java application, LIBPATH is set to /usr/lib.
120 With traditional shared library versioning, the runtime loader fails to load [libiconv.so.2]
121 from /usr/lib/libiconv.a again.
122
123 For complete history see https://bugs.gentoo.org/show_bug.cgi?id=213277
124
125 /haubi/

Replies

Subject Author
Re: [gentoo-alt] AIX-specific early stage3 dependencies Ruud Koolen <redlizard@g.o>