From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 21 08:02:26 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DFE9F16A405 for ; Fri, 21 Apr 2006 08:02:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from fw.zoral.com.ua (ll-227.216.82.212.sovam.net.ua [212.82.216.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id BB26A43D4C for ; Fri, 21 Apr 2006 08:02:24 +0000 (GMT) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by fw.zoral.com.ua (8.13.4/8.13.4) with ESMTP id k3L82Hxg032137 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Apr 2006 11:02:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.13.6/8.13.6) with ESMTP id k3L82Hk3094244; Fri, 21 Apr 2006 11:02:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.13.6/8.13.6/Submit) id k3L82H37094243; Fri, 21 Apr 2006 11:02:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 21 Apr 2006 11:02:17 +0300 From: Kostik Belousov To: Jeremie Le Hen Message-ID: <20060421080216.GB1446@deviant.kiev.zoral.com.ua> References: <20060420114822.GB35261@obiwan.tataz.chchile.org> <20060420124829.GA1446@deviant.kiev.zoral.com.ua> <20060420221623.GD68951@obiwan.tataz.chchile.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NMuMz9nt05w80d4+" Content-Disposition: inline In-Reply-To: <20060420221623.GD68951@obiwan.tataz.chchile.org> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: ClamAV version 0.88.1, clamav-milter version 0.88.1 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.1 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on fw.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: [fbsd] Re: Symbol weirdness with static linking X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Apr 2006 08:02:26 -0000 --NMuMz9nt05w80d4+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 21, 2006 at 12:16:23AM +0200, Jeremie Le Hen wrote: > Hi, Kostik, >=20 > > > For the sake of completeness, I added the output of some objdump(1) > > > outputs here : > > >=20 > > > /usr/obj/usr/src/bin/echo/echo.o: > > > http://tataz.chchile.org/~tataz/symbol_weirdness/objdump-t_echo.txt.gz > > >=20 > > > /usr/obj/usr/src/tmp/usr/lib/libc.a: > > > http://tataz.chchile.org/~tataz/symbol_weirdness/objdump-t_libc.txt.gz > > >=20 > > > /usr/obj/usr/src/tmp/usr/lib/libssp.a: > > > http://tataz.chchile.org/~tataz/symbol_weirdness/objdump-t_libssp.txt= .gz > >=20 > > It seems that you rebuilt world with CFLAGS -fstack-protector, > > since your libc has references to the symbols like __stack_smash_handle= r. > > As result, when linking with sequence -lgcc -lssp -lc -lgcc -lssp, > > and no references from the main object, > > references from libc causes objects from _second_ instance of -lssp to > > be pulled into the link. Since libraries are scanned sequentially, > > this object from libssp has no way to get required dependencies > > from libc. >=20 > Yes, I understand that. But I can't see what's the difference between > "syslog" and "sigfillset" symbols from this standpoint. The fact the > former requires ProPolice/SSP doesn't interfere IMHO. >=20 > > What makes syslog(3) special is that corresponding object from libc, > > syslog.o, requires __stack_smash_handler, while objects for mentioned > > syscalls do not. >=20 > How does it prevent the "syslog" symbol from being found ? Libc > undefined symbols implies the second libssp to be pulled in which in > turn has undefined symbol. But since there is no more libc after this, > "sigfillset" should be missing either. >=20 > I would understand if echo.o needed some symbols provided by the same > archive than "sigfillset" (sigsetops.o) but this is not the case. >=20 You are absolutely right, my error. "Explanation" with syslog dependency on stack_smash is wrong. In fact, building bin/echo on CURRENT with -DNO_SHARED gives deviant% objdump -t echo | grep sigfillset 08056dc0 g F .text 00000021 sigfillset It seems that at least the following dependency chain is present (for 6-STABLE): malloc -> abort -> sigfillset, and malloc is referenced by echo. For CURRENT, (possibly, another) dependency also pulls sig* from libc. Sorry for misinformation, I was innacurate when looking at issue. --NMuMz9nt05w80d4+ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) iD8DBQFESJGHC3+MBN1Mb4gRAgJiAJ9gxwu6Yq4CCc5ohDivBMVvWmBFsgCfdi1O 4110x28RkZ6EfhheptEOPCc= =yrs0 -----END PGP SIGNATURE----- --NMuMz9nt05w80d4+--