From nobody Wed Apr 09 19:27:52 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZXtJS55yzz5sG11; Wed, 09 Apr 2025 19:27:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZXtJS2TJPz4513; Wed, 09 Apr 2025 19:27:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744226872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I/QKrkhcsSHJaMG/WWIxdDMCjXAs0aQx7qk9v3yufxc=; b=m+lK0OsNzqNrUhHR62ss/ESZ8QIh7pmYWkZBeuIHnTzPOEgnj7oaf2ovBA1xZKcD6Sie3+ NfiIBKFM9wUULRwf0UnSrBdYc7WGwWsQe9CYlEd0AdOqauRC0wOpNN5DLc4jPsGeljUtR/ +KMo10lnXQ8xGUhTtgiMsOGkIlmHMGIiR+PO7cLvzUjyGaB3LWX3MV7OVevuxHvDiIi4XL hgSVXMYmHlwchM142d1i/FH9YK+m4F+SPiK+G4jbMIgg8e4doVMmZlRG6QbLEhXwJGmo1A JqUOiBxL0g6T0oOJMegBi4i9pybF09alzbcvib1cSPTkvyan/gZNv1xzJyC4vw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1744226872; a=rsa-sha256; cv=none; b=dCSmEQLvEquhyeHMUzTs7MHBkYFP1NB3mY6WDZhvfx+KVfIE9/vayxHwihOrrXe8xkRlR0 xhi5zwEZszRNeUdHzID0J6pQ2yD37kJPsIOECK606qM2TzPeqTbtRGJpDgiZn0M7DtpoD9 b1bMK52jdgVLBMRdSCBjuT9ojiqGhiC4KJzIgVOaLKEOHzJeiOC6PvbFfwHQXGJpwofdwG lmY9AMGQ9Rnkhi95oPhXbgwf5d+zyavS0qNGXUlpBwZzpQehOMg1XuDhceup/t3EWy0v+9 XeujHPi1YWmWY5gNeZB2fyu4kLcJlzjZergT85OihKf/eVdMrgJ/ZdzoZNVmQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1744226872; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I/QKrkhcsSHJaMG/WWIxdDMCjXAs0aQx7qk9v3yufxc=; b=YRAi9s3bKDUgvz8E1bHKYS1IWPify1ebhWEwd38CzFv4/4Y8/fjdTSYqbFa9eFINkw2ge4 T3q18YebbGVAw6wRy2eTgw3TkBDv9r14uYaoi8EVB8wEZq9U4Bsz4tNkLrRJBIJCmUPpzQ ODoO1ZDuLGTSXQNLf0RCRbaZ0SKtF6PUMN4QO54zPhccGVEttWA9eiv2ElOu0xCF0xeCnI M9Eg0ftv7grhOaN2zqZ/LmP7i/H7VMsi5AKz20zO8oAmM3WdT5Y9EEoIszGWE95xzuLnLF 7zaS4HcMgcy/znD6+ALmXbjho0tlS8+oZE3ijmUCoH4osjDfqbVDDuQWMMwoMg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZXtJS1n4tzVbs; Wed, 09 Apr 2025 19:27:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 539JRqmO070459; Wed, 9 Apr 2025 19:27:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 539JRqYm070456; Wed, 9 Apr 2025 19:27:52 GMT (envelope-from git) Date: Wed, 9 Apr 2025 19:27:52 GMT Message-Id: <202504091927.539JRqYm070456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 22921f4b4aed - main - boot: Fall back to objcopy if usable for EFI components List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22921f4b4aedb5017b727e62045130ab69c3dd1b Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=22921f4b4aedb5017b727e62045130ab69c3dd1b commit 22921f4b4aedb5017b727e62045130ab69c3dd1b Author: Ed Maste AuthorDate: 2025-03-25 13:34:23 +0000 Commit: Ed Maste CommitDate: 2025-04-09 19:26:54 +0000 boot: Fall back to objcopy if usable for EFI components In commit b885643b63e4 ("boot: Always use ELF Tool Chain elfcopy for EFI builds") I switched to using elfcopy for EFI_OBJCOPY, as llvm-objcopy lacks support for translating ELF objects to PE32+. This broke building on older releases with WITHOUT_ELFTOOLCHAIN_BOOTSTRAP set, as the host did not provide elfcopy and it was not built as a bootstrap tool. Now, if we're not bootstrapping ELF Tool Chain we check the output of `${OBJCOPY} --version`, and will use that ${OBJCOPY} as long as it is not llvm-objcopy. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49722 --- stand/efi/Makefile.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/stand/efi/Makefile.inc b/stand/efi/Makefile.inc index f91ac9102ca8..6bb0af1d84f3 100644 --- a/stand/efi/Makefile.inc +++ b/stand/efi/Makefile.inc @@ -1,3 +1,5 @@ +.include + # Options used when building app-specific efi components # See conf/kern.mk for the correct set of these CFLAGS+= -Wformat @@ -26,7 +28,20 @@ EFI_TARGET= efi-app-x86_64 .else EFI_TARGET= binary .endif + +# GNU or ELF Tool Chain objcopy is usable for building EFI objects. +# LLVM objcopy is not. Use elfcopy if we've bootstrapped it (and thus +# known to be available) or objcopy is LLVM's. +.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" EFI_OBJCOPY?= elfcopy +.else +_v!= ${OBJCOPY} --version +.if ${_v:Mllvm-objcopy*} == "" +EFI_OBJCOPY?= ${OBJCOPY} +.else +EFI_OBJCOPY?= elfcopy +.endif +.endif # Arbitrarily set the PE/COFF header timestamps to 1 Jan 2024 00:00:00 # for build reproducibility.