From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 16 Nov 2009 03:44:38 +0300 From: Alexey Tourbin To: ALT Linux Team development discussions Message-ID: <20091116004438.GU10659@altlinux.org> Mail-Followup-To: ALT Linux Team development discussions References: <1258101392.3733.55.camel@marsh.altlinux.lan> <200911150336.12883.ledest@gmail.com> <20091115070652.GA15510@mw.office.seiros.ru> <200911152200.02524.ledest@gmail.com> <20091115211443.GR10659@altlinux.org> <20091116000546.GA32432@wo.int.altlinux.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iskw6J4cuOvZ6IVF" Content-Disposition: inline In-Reply-To: <20091116000546.GA32432@wo.int.altlinux.org> Subject: Re: [devel] symbols into dependencies X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 00:44:39 -0000 Archived-At: List-Archive: List-Post: --iskw6J4cuOvZ6IVF Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 16, 2009 at 03:05:46AM +0300, Dmitry V. Levin wrote: > On Mon, Nov 16, 2009 at 12:14:43AM +0300, Alexey Tourbin wrote: > [...] > > =E5=D3=D4=D8 =C9=C4=C5=D1 =C6=CF=D2=CD=C9=D2=CF=D7=C1=D4=D8 =DA=C1=D7= =C9=D3=C9=CD=CF=D3=D4=C9 =CE=C1 =D3=CF=CE=C5=CA=CD=D9 =D3 =D5=DE=C5=D4=CF= =CD =D3=C9=CD=D7=CF=CC=CF=D7. > > =FC=D4=CF =CD=CF=D6=C5=D4 =D7=D9=C7=CC=D1=C4=C5=D4=D8 =D4=C1=CB: > >=20 > > %package -n libfoo > > Provides(auto): libfoo.so.1 =3D set:0123abcd...(=CF=DE=C5=CE=D8 =C4=CC= =C9=CE=CE=C1=D1 =D3=D4=D2=CF=CB=C1) > >=20 > > %package -n foo > > Requires(auto): libfoo.so.1 >=3D set:abcd0123...(=D5=CD=C5=D2=C5=CE=CE= =CF =C4=CC=C9=CE=CE=C1=D1 =D3=D4=D2=CF=CB=C1) > >=20 > > =F4=CF =C5=D3=D4=D8 =D2=C5=C1=CC=C9=DA=CF=D7=C1=D4=D8 =DA=C1=D7=C9=D3= =C9=CD=CF=D3=D4=C9 =D3=D0=C5=C3=C9=C1=CC=D8=CE=CF=C7=CF =D7=C9=C4=C1, =CB= =CF=D4=CF=D2=D9=C5 =D0=D2=C5=C4=D3=D4=C1=D7=CC=D1=C0=D4 > > =D3=CF=C2=CF=CA "=CD=CE=CF=D6=C5=D3=D4=D7=CF =D3=D4=D2=CF=CB" (=D3=C9= =CD=D7=CF=CC=CF=D7). =F7=CD=C5=D3=D4=CF =CF=C2=D9=DE=CE=CF=C7=CF =D3=D2=C1= =D7=CE=C5=CE=C9=D1 =D7=C5=D2=D3=C9=CA > > =C4=CC=D1 =D4=C1=CB=C9=C8 =DA=C1=D7=C9=D3=C9=CD=CF=D3=D4=C5=CA =C2=D5= =C4=C5=D4 =D7=D9=D0=CF=CC=CE=D1=D4=D8=D3=D1 =D0=D2=CF=D7=C5=D2=CB=C1, =DE= =D4=CF requires set > > =D1=D7=CC=D1=C5=D4=D3=D1 =D0=CF=C4=CD=CE=CF=D6=C5=D3=D4=D7=CF=CD provid= es set. >=20 > Please do not over-optimize here. > For example, have a look at /bin/ls ELF executable: >=20 > $ readelf -d /bin/ls |awk '/NEEDED/{print $5}' > [librt.so.1] > [libcap.so.2] > [libtinfo.so.5] > [libacl.so.1] > [libc.so.6] > $ readelf -s /bin/ls |grep tgetent > 36: 0000000000000000 0 FUNC GLOBAL DEFAULT UND tgetent >=20 > Where does the "tgetent" symbol come from? Dynamic linker will be > sufficed if at least one of abovementioned libraries will provide it. According to System V Application Binary Interface (gabi41.pdf), tgetent comes from libcurses (p.125). This gives strong evidence for associating symbols with libraries they come from. > Here is a more artificial example written to demonstrate ld.so behaviour: > $ echo 'int a(){return 1;}' >liba.c && > gcc -fpic -shared liba.c -o liba.so && > echo 'int b(){return 2;}' >libb.c && > gcc -fpic -shared libb.c -o libb.so && > echo 'int main(){return a()+b();}' >exe.c && > gcc exe.c -L. -la -lb -o exe && > LD_LIBRARY_PATH=3D. ./exe; echo $?; > echo 'int b(){return 10;}' >liba.c && > gcc -fpic -shared liba.c -o liba.so && > echo 'int a(){return 20;}' >libb.c && > gcc -fpic -shared libb.c -o libb.so && > LD_LIBRARY_PATH=3D. ./exe; echo $? > 3 > 30 >=20 > That is, a needed ELF symbol may jump from one library to another. > And it had happened once with the "tgetent" symbol. When a symbol is moved to another library, some programs might need relinking, while some might still work. Let's see what happens if a symbol is moved from libA to libB. The programs that use the symbol and linked only to libA go broke, right? But programs which are linked to both libA and libB are fine. Do you mean it is possible to handle these cases differently? To sum up, when a function is moved to another library, the ABI is changed, and the programs should be relinked. It is only by chance that some programs might still work. > P.S. This issue is not an ALT Linux specific, so if we succeed to > work out a solution, it could be used by others. They don't care. Otherwise they'd come with something more smart. :) --iskw6J4cuOvZ6IVF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAksAoHUACgkQfBKgtDjnu0bOKgCg5MSEg5aO9ruEDiqnBg/cmKl4 88MAoIaXNcc7MGiuoySCdF08aFynCMIq =5uZ/ -----END PGP SIGNATURE----- --iskw6J4cuOvZ6IVF--