Date: Fri, 23 Jun 2017 09:43:00 -0700 From: Bryan Drewery <bdrewery@FreeBSD.org> To: Konstantin Belousov <kostikbel@gmail.com>, Ed Maste <emaste@FreeBSD.org> 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: <f6672cf9-9a2f-e6f0-7c08-88d47cfa6174@FreeBSD.org> In-Reply-To: <20170623162859.GL3437@kib.kiev.ua> References: <201706231557.v5NFvw8g098666@repo.freebsd.org> <20170623162859.GL3437@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --iAqIDL4FAWgTdH0PFtGjl3UQ1VotPpvH6 Content-Type: multipart/mixed; boundary="lFdDxvMkNesgbR8fgnHquGnmOInPtQxTr"; protected-headers="v1" From: Bryan Drewery <bdrewery@FreeBSD.org> To: Konstantin Belousov <kostikbel@gmail.com>, Ed Maste <emaste@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <f6672cf9-9a2f-e6f0-7c08-88d47cfa6174@FreeBSD.org> Subject: Re: svn commit: r320272 - head/sys/conf References: <201706231557.v5NFvw8g098666@repo.freebsd.org> <20170623162859.GL3437@kib.kiev.ua> In-Reply-To: <20170623162859.GL3437@kib.kiev.ua> --lFdDxvMkNesgbR8fgnHquGnmOInPtQxTr Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 6/23/2017 9:28 AM, Konstantin Belousov wrote: > 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 >> =20 >> A Build-ID is an identifier generated at link time to uniquely ident= ify >> ELF binaries. It allows efficient confirmation that an executable o= r >> 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.) >> =20 >> The FreeBSD base system includes GNU bfd ld 2.17.50 as the linker fo= r >> architectures other than arm64. Build-ID support was added to bfd l= d >> shortly after that version, so was not previously available to us. >> =20 >> We can now start making use of Build-ID as we migrate to using lld o= r >> bfd ld from ports, conditionally enabled based on the LINKER_TYPE an= d >> LINKER_VERSION make variables added in r320244 and subsequent commit= s. >> =20 >> 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 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- 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=3D ${PROF} >> # can override the others. >> CFLAGS+=3D ${CONF_CFLAGS} >> =20 >> +.if ${LINKER_TYPE} !=3D "bfd" || ${LINKER_VERSION} > 21750 > I believe such tests is the road to misery. I suggest that an ld featu= re > presence must define some variable for make, and the places using the > ld feature would test for the variable. >=20 > In other words, checking the features must be centralized. There is to= o > many linkers already: bfd, gold, lld. Since two new linkers appeared i= n > five years, I would be not surprised if more will. Agreed. We can have a LINKER_FEATURES like we do for the compiler. In this case I suggest just moving the same condition you have added into bsd.linker.mk with something like https://people.freebsd.org/~bdrewery/patches/linker-features-build-id.dif= f Then in these sys/conf places you just: =2Eif ${LINKER_FEATURES:Mbuild-id} LDFLAGS+=3D >=20 > 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. >=20 >> +LDFLAGS+=3D -Wl,--build-id=3Dsha1 >> +.endif >> + >> # Optional linting. This can be overridden in /etc/make.conf. >> LINTFLAGS=3D ${LINTOBJKERNFLAGS} >> =20 >> >> Modified: head/sys/conf/kmod.mk >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- 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+=3D --param large-function-growth=3D10= 00 >> CFLAGS+=3D -fno-common >> LDFLAGS+=3D -d -warn-common >> =20 >> +.if ${LINKER_TYPE} !=3D "bfd" || ${LINKER_VERSION} > 21750 >> +LDFLAGS+=3D -Wl,--build-id=3Dsha1 >> +.endif >> + >> CFLAGS+=3D ${DEBUG_FLAGS} >> .if ${MACHINE_CPUARCH} =3D=3D amd64 >> CFLAGS+=3D -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer >=20 --=20 Regards, Bryan Drewery --lFdDxvMkNesgbR8fgnHquGnmOInPtQxTr-- --iAqIDL4FAWgTdH0PFtGjl3UQ1VotPpvH6 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJZTUUUAAoJEDXXcbtuRpfPJqgH/R+fz6S85B5e/vBHI4NEPTHh 6UPiDweZRShpA/vb45FaEuLUyapZ3yp2/690aT0o6ryFQFn88Q9hnItwUaG+emhw xlZUDNt1vfkOpukvZQ4pjtEdXpDV9Kx+davwwDHmmmaBMKAD/kF303vVMlqgVqQI kTulpSrFZHR8C61YDTvgfmkRBQ8ESG1DAgomXS/8NJvlRePOzFVo+3qM6nQCf9nC p+QIVVRoCJmQykk0oiwu2EbKcL0i4oraU+wnZzcvVapcpdvvyjB2HN9a5dsaFpZH oEkvHG1CSvA0LovWxUb9gizSNFk9Lizz/4PfmbmeLRKjGfh18eDxCUvN5GSAQxE= =UJsD -----END PGP SIGNATURE----- --iAqIDL4FAWgTdH0PFtGjl3UQ1VotPpvH6--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f6672cf9-9a2f-e6f0-7c08-88d47cfa6174>