From owner-svn-src-head@freebsd.org Fri Jun 23 16:29:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAE4ADA794A; Fri, 23 Jun 2017 16:29:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B94466424; Fri, 23 Jun 2017 16:29:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v5NGSxPe034399 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 23 Jun 2017 19:28:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v5NGSxPe034399 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v5NGSxcj034398; Fri, 23 Jun 2017 19:28:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 23 Jun 2017 19:28:59 +0300 From: Konstantin Belousov To: Ed Maste Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r320272 - head/sys/conf Message-ID: <20170623162859.GL3437@kib.kiev.ua> References: <201706231557.v5NFvw8g098666@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201706231557.v5NFvw8g098666@repo.freebsd.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jun 2017 16:29:06 -0000 On Fri, Jun 23, 2017 at 03:57:58PM +0000, Ed Maste wrote: > Author: emaste > Date: Fri Jun 23 15:57:58 2017 > New Revision: 320272 > URL: https://svnweb.freebsd.org/changeset/base/320272 > > Log: > enable --build-id for the kernel link > > A Build-ID is an identifier generated at link time to uniquely identify > ELF binaries. It allows efficient confirmation that an executable or > shared library and a corresponding standalone debuginfo file match. > (Otherwise, a checksum of the debuginfo file must be calculated when > opening it in a debugger.) > > The FreeBSD base system includes GNU bfd ld 2.17.50 as the linker for > architectures other than arm64. Build-ID support was added to bfd ld > shortly after that version, so was not previously available to us. > > We can now start making use of Build-ID as we migrate to using lld or > bfd ld from ports, conditionally enabled based on the LINKER_TYPE and > LINKER_VERSION make variables added in r320244 and subsequent commits. > > Reviewed by: dim > MFC after: 3 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D11314 > > Modified: > head/sys/conf/kern.pre.mk > head/sys/conf/kmod.mk > > Modified: head/sys/conf/kern.pre.mk > ============================================================================== > --- head/sys/conf/kern.pre.mk Fri Jun 23 15:27:23 2017 (r320271) > +++ head/sys/conf/kern.pre.mk Fri Jun 23 15:57:58 2017 (r320272) > @@ -114,6 +114,10 @@ DEFINED_PROF= ${PROF} > # can override the others. > CFLAGS+= ${CONF_CFLAGS} > > +.if ${LINKER_TYPE} != "bfd" || ${LINKER_VERSION} > 21750 I believe such tests is the road to misery. I suggest that an ld feature presence must define some variable for make, and the places using the ld feature would test for the variable. In other words, checking the features must be centralized. There is too many linkers already: bfd, gold, lld. Since two new linkers appeared in five years, I would be not surprised if more will. Having to deal with combinations at places of use is not scalable. We do it close to right with C compilers and sys/cdefs.h. > +LDFLAGS+= -Wl,--build-id=sha1 > +.endif > + > # Optional linting. This can be overridden in /etc/make.conf. > LINTFLAGS= ${LINTOBJKERNFLAGS} > > > Modified: head/sys/conf/kmod.mk > ============================================================================== > --- head/sys/conf/kmod.mk Fri Jun 23 15:27:23 2017 (r320271) > +++ head/sys/conf/kmod.mk Fri Jun 23 15:57:58 2017 (r320272) > @@ -125,6 +125,10 @@ CFLAGS.gcc+= --param large-function-growth=1000 > CFLAGS+= -fno-common > LDFLAGS+= -d -warn-common > > +.if ${LINKER_TYPE} != "bfd" || ${LINKER_VERSION} > 21750 > +LDFLAGS+= -Wl,--build-id=sha1 > +.endif > + > CFLAGS+= ${DEBUG_FLAGS} > .if ${MACHINE_CPUARCH} == amd64 > CFLAGS+= -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer