From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 20 16:29:36 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62F3B10656C5; Mon, 20 Sep 2010 16:29:36 +0000 (UTC) (envelope-from jeremie@le-hen.org) Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5]) by mx1.freebsd.org (Postfix) with ESMTP id 32B348FC15; Mon, 20 Sep 2010 16:29:33 +0000 (UTC) Received: from endor.tataz.chchile.org (unknown [82.233.239.98]) by smtp5-g21.free.fr (Postfix) with ESMTP id 4CCD5D48096; Mon, 20 Sep 2010 18:29:27 +0200 (CEST) Received: from felucia.tataz.chchile.org (felucia.tataz.chchile.org [192.168.1.9]) by endor.tataz.chchile.org (Postfix) with ESMTP id 3609933D77; Mon, 20 Sep 2010 16:29:26 +0000 (UTC) Received: by felucia.tataz.chchile.org (Postfix, from userid 1000) id 14F23A11ED; Mon, 20 Sep 2010 16:29:26 +0000 (UTC) Date: Mon, 20 Sep 2010 18:29:25 +0200 From: Jeremie Le Hen To: Kostik Belousov Message-ID: <20100920162925.GL6864@felucia.tataz.chchile.org> References: <20100803150545.GH14016@felucia.tataz.chchile.org> <20100803114651.651e0ea4@kan.dnsalias.net> <20100805191446.GJ14016@felucia.tataz.chchile.org> <20100919081406.GH6864@felucia.tataz.chchile.org> <20100919184146.GE2389@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100919184146.GE2389@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: kan@freebsd.org, freebsd-hackers@freebsd.org, Jeremie Le Hen Subject: Re: [PATCH] Add -lssp_nonshared to GCC's LIB_SPEC unconditionally 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: Mon, 20 Sep 2010 16:29:36 -0000 Kostik, On Sun, Sep 19, 2010 at 09:41:46PM +0300, Kostik Belousov wrote: > On Sun, Sep 19, 2010 at 10:14:06AM +0200, Jeremie Le Hen wrote: > > Hi Alexander, > > > > On Thu, Aug 05, 2010 at 09:14:46PM +0200, Jeremie Le Hen wrote: > > > On Tue, Aug 03, 2010 at 11:46:51AM -0400, Alexander Kabaev wrote: > > > > > > > > I have no objection, but think we should cave in and investigate the > > > > possibility of using linker script wrapping libc.so in FreeBSD-9.0: > > > > > > > > Below is Linux' counterpart: > > > > > > > > /* GNU ld script > > > > Use the shared library, but some functions are only in > > > > the static library, so try that secondarily. */ > > > > OUTPUT_FORMAT(elf32-i386) > > > > GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED > > > > ( /lib/ld-linux.so.2 ) ) > > > > > > Ok. For now can you commit the proposed modification. I'll try to make > > > a patch with your proposal. > > > > The attached patch does two things: It modifies bsd.lib.mk to support ld > > scripts for shared libraries and adds such a script to replace the > > /usr/lib/libc.so symlink to /lib/libc.so.X. > > > > Basically, SHLIB_LDSCRIPT is defined in lib/libc/Makefile and points to > > the file containing the script itself: > > GROUP ( @@SHLIB@@ /usr/lib/libssp_nonshared.a ) > > > > During make install, @@SHLIB@@ will be replaced by the real path of the > > shared library. > > You did not included $FreeBSD$ tag into libc.so script. I think it would be > useful to have. Sure. I will send an updated patch a little later. > Could you, please, comment why the script is not installed during the > world build stage ? My question is, would the buildworld use the script > for linkage ? libc.ld, the generated ldscript in ${.OBJDIR}, is built along with libc.so.7 which is built only once (stage 4.2 of buildworld). In order to get buildworld use the ld script, it would require to generate it twice: once during stage 4.2 using /usr/obj/usr/src/tmp/lib/libc.so.7 and another one afterward using /lib/libc.so.7. Besides I didn't see an advantage to do this because when compiling the base system, CFLAGS and LDFLAGS are well controlled so -fstack-protector will be provided when linking the program. On the other hand, the patch I propose is required for the numerous ports for which we do not control linking flags; lang/perl comes into my mind. If you want to compile it with SSP, you have to patch its build infrastructure (see ports/138228). Regards, -- Jeremie Le Hen Humans are born free and equal. But some are more equal than others. Coluche