[Bug 280771] elftoolchain tools used by bootstrap regardless of LLVM_BINUTILS

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 12 Aug 2024 13:27:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280771

            Bug ID: 280771
           Summary: elftoolchain tools used by bootstrap regardless of
                    LLVM_BINUTILS
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: emaste@freebsd.org

Makefile.inc1 always builds ELF Tool Chain tools for bootstrap, regardless of
the setting of WITH_/WITHOUT_LLVM_BINUTILS. I discovered this because I tried
to build loader_lua.efi outside of buildenv on a system with WITH_LLVM_BINUTILS
as the default, and the build failed with:

$ make -C stand/efi/loader_lua/
SOURCE_DATE_EPOCH=1451606400  objcopy -j .peheader -j .text -j .sdata -j .data 
-j .dynamic -j .dynsym -j .rel.dyn  -j .rela.dyn -j .reloc -j .eh_frame -j
set_Xcommand_set  -j set_Xlua_compile_set  --output-target=efi-app-x86_64
loader_lua.sym loader_lua.efi
objcopy: error: invalid output format: 'efi-app-x86_64'
*** Error code 1

(Once this issue is addressed we'll also have to deal with llvm-objcopy's lack
of support for efi-app-x86_64.)

From Makefile.inc1:

# If we're given an XAS, don't build binutils.
.if ${XAS:M/*} == ""
.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
_elftctools=    lib/libelftc \
                lib/libpe \
                usr.bin/elfctl \
                usr.bin/elfdump \
                usr.bin/objcopy \
                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

-- 
You are receiving this mail because:
You are the assignee for the bug.