Created attachment 185450 [details] add libllvm debuginfo when LLD_BOOTSTRAP is on When trying to build with options LLD_BOOTSTRAP=yes and WITHOUT_LLD_IS_LD=yes in src.conf, the initial build of libllvm will be missing certain DebugInfo subdirectories/objects required for ld.lld to proceed. Patch attached fixes this.
Build log: http://xmj.me/freebsd/buildworld_llvm_lld.log
Your change will stop the build from failing, but I don't think will have the desired effect (the cross-build /usr/bin/ld will still be ld.bfd, I believe). Can you give this (untested) patch a try? Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 322559) +++ Makefile.inc1 (working copy) @@ -557,6 +557,7 @@ # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + MK_LLD_IS_LD=${MK_LLD_BOOTSTRAP} \ MK_GDB=no MK_TESTS=no # kernel-tools stage
(In reply to Ed Maste from comment #2) Ed, I flipped your patch around to better fit my actual usecase: build with ld.bfd on HardenedBSD (which sets LLD_BOOTSTRAP on by default, to use CFI and others). I've verified this works: diff --git a/Makefile.inc1 b/Makefile.inc1 index 1c10579bf80..f4a17266cee 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -557,6 +557,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + MK_LLD_BOOTSTRAP=${MK_LLD_IS_LD} \ MK_GDB=no MK_TESTS=no # kernel-tools stage I will try to redo it in `share/mk/src.opts.mk` some time later today.
The sense of your change is backwards though, because MK_LLD_BOOTSTRAP is intended to control whether LLD is used as the linker while building world.
A commit references this bug: Author: emaste Date: Wed Aug 23 12:47:10 UTC 2017 New revision: 322811 URL: https://svnweb.freebsd.org/changeset/base/322811 Log: Set MK_LLD_IS_LD to MK_LLD_BOOTSTRAP for cross-tools LLD_BOOTSTRAP is intended to control the linker used to link world and kernel, while LLD_IS_LD is intended to control the linker installed in that world. Force LLD_IS_LD equal to LLD_BOOTSTRAP for the cross-tools build and install phase, so that lld will be installed as the ld to run on the host, when LLD_BOOTSTRAP is set. PR: 221543 Reviewed by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12072 Changes: head/Makefile.inc1