Makefile.inc1: Rework ELF Tool Chain bootstrapping

Remove additional conditions and bootstrap elfctl, elfdump, and elfcopy
(aka objdump) if ELFTOOLCHAIN_BOOTSTRAP is true.  The first two are
bespoke tools that won't exist in an external GNU or LLVM binutils, and
elfcopy is also not provided by that name.

This should fix GCC CI builds, which was skipping the elfcopy build
because of the ${TARGET_ARCH} != ${MACHINE_ARCH} condition.

Reported by:	olce
Reviewed by:	brooks
Fixes: b885643b63 ("boot: Always use ELF Tool Chain elfcopy for EFI builds")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49493
This commit is contained in:
Ed Maste 2025-03-25 09:47:50 -04:00
parent 9eb6cdafe5
commit 7d70f8b482

View file

@ -2909,29 +2909,24 @@ _dtrace_tools= cddl/lib/libctf cddl/lib/libspl cddl/usr.bin/ctfconvert \
cddl/usr.bin/ctfmerge
.endif
# If we're given an XAS, don't build binutils.
.if ${XAS:M/*} == ""
.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
# Some bespoke tools from or based on ELF Tool Chain. objcopy (elfcopy) is
# included because llvm-objcopy is currently not capable of translating ELF to
# PE32+, which is required for EFI boot programs.
_elftctools= lib/libelftc \
lib/libpe \
usr.bin/elfctl \
usr.bin/elfdump \
usr.bin/objcopy \
usr.bin/nm \
usr.bin/objcopy
# If we're given an XNM we don't need to build standard binary utilities.
.if ${XNM:M/*} == ""
_elftctools+= usr.bin/nm \
usr.bin/size \
usr.bin/strings
# These are not required by the build, but can be useful for developers who
# cross-build on a FreeBSD 10 host:
_elftctools+= usr.bin/addr2line
.endif
.elif ${TARGET_ARCH} != ${MACHINE_ARCH} && ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
# If cross-building with an external binutils we still need to build strip for
# the target (for at least crunchide).
_elftctools= lib/libelftc \
lib/libpe \
usr.bin/elfctl \
usr.bin/elfdump \
usr.bin/objcopy
.endif
.if ${MK_CLANG_BOOTSTRAP} != "no"