From owner-freebsd-current@FreeBSD.ORG Tue Feb 3 07:46:00 2015 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DEB05DEF; Tue, 3 Feb 2015 07:45:59 +0000 (UTC) Received: from mail-pa0-x22e.google.com (mail-pa0-x22e.google.com [IPv6:2607:f8b0:400e:c03::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8E59FE9; Tue, 3 Feb 2015 07:45:59 +0000 (UTC) Received: by mail-pa0-f46.google.com with SMTP id lj1so92999101pab.5; Mon, 02 Feb 2015 23:45:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=S56aGp0HIC6FHoHWgzvsYwUTFXyryncWkmQYV2S/350=; b=dWD8tk905IKzXNq6eFRUNbfTCWO7+4k7RESP39dxTdZfpxzjfXg9ezM7LvVvmCEimo Am/8aOxmNfhG+K8thZ6rxDLLeRFaUocNQQkDngNhmFRCEJh9bIsJ6EUvKRLV1hJrhqGt 0lHyrz/LriZ7OBIe8N9XHgyIpLDt4hKBCHN2FReXOVanq8zm+MALGXHrdAHNwRIL3qZO g0jYb/8bUDNQj6IMfngSGB6PAwIN+010Xr4ndQHWed4h0b8SJvrzq2JiQzeXPj7nUk7h BFCYHMdM5i8yUEqx6ncEmIlBh1mpZVzC6qiw5hK2XKaI/JU+5sMlAx+ZMuR0XWaMxuAr RVeg== X-Received: by 10.68.189.71 with SMTP id gg7mr1353331pbc.21.1422949559283; Mon, 02 Feb 2015 23:45:59 -0800 (PST) Received: from localhost (c-76-21-76-83.hsd1.ca.comcast.net. [76.21.76.83]) by mx.google.com with ESMTPSA id nw6sm1180842pbb.94.2015.02.02.23.45.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Feb 2015 23:45:58 -0800 (PST) Sender: Gleb Kurtsou Date: Mon, 2 Feb 2015 23:47:09 -0800 From: Gleb Kurtsou To: Jeremie Le Hen Subject: Re: libc.so dependency on libssp_nonshared.a Message-ID: <20150203074709.GA1091@reks> Mail-Followup-To: Jeremie Le Hen , freebsd-current@freebsd.org References: <20150201202413.GA2132@reks> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: freebsd-current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2015 07:46:00 -0000 On (02/02/2015 17:06), Jeremie Le Hen wrote: > Hi Gleb, > On Sun, Feb 1, 2015 at 9:24 PM, Gleb Kurtsou wrote: > > I came across some build issues in libc.so and SSP. > > > > libc.ldscript (aka libc.so) unconditionally includes @@LIBDIR@@/libssp_nonshared.a > > > > libssp* are not built if WITHOUT_SSP defined. > > > > ObsoleteFiles.inc doesn't mention libssp*. > > > > Consider WITHOUT_SSP=yes case. As soon as one does clean installworld > > and/or removes stale libssp_nonshared.a ld fails to link anything > > because of missing libssp_nonshared.a > > I think nowadays it would make sense to get it of WITHOUT_SSP > altogether. This will turn this into a non-issue. Do you mean building libssp_nonshared unconditionally? It makes perfect sense. The library is a single stub function. By building libssp* conditionally we may expect that -fstack-protector complier option won't work. I wasn't able to reproduce this potential problem. libc provides __stack_chk_fail and __stack_chk_guard. And I failed to create a test case that would generate code using anything like __memcpy_chk. Perhaps we should change MK_SSP to operate as documented (add -fstack-protector to CFLAGS) and consider adding MK_SSP_SUPPORT option for libraries. Although there is no reason to have MK_SSP_SUPPORT if that would imply failure to run binaries or compile with -fstack-protector. > > libc.so during buildworld (as found under /usr/obj) is symlink to the > > actual shared library, but not ldscript. Is it intentional? I wouldn't > > expect make -C /usr/src/bin/cat to match buildworld result closely > > assuming src and world are in sync, but they seem to have different idea > > of what libc is.. > > I don't remember the details except this was pretty twisted :). I > don't work enough on this subject to keep it warm in my head and each > time I need to go back to it, it takes me hours. > > The code is here if you want to give a try: > http://svnweb.freebsd.org/base/head/share/mk/bsd.lib.mk?view=annotate#l335 indeed.