From patchwork Mon Jul 29 14:31:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 13745145 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F909C3DA4A for ; Mon, 29 Jul 2024 14:52:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OwZ+YBV1g2FbL6rUY0RQPmFN47MEogO4EgPmT2v1gcA=; b=Ooxp8roHhVLiW0YBQrkhRfFewM ZGl7QOeZ+4N3YPD6Jvh7lIHY9LnHA35TMcx1WJR/Jg5ipeNVgeBNtQDy+pIkrLHJukDsi0sTo56Zh JgkHoQQ5IagPKUpTq9ZbKMDRVDVl96EI6KMjZPKNV7ojQYa+5TaqzkGrXVJPISuduC2nXD9V+fYGK IGuHGhRJ4Fgcn7oG0cURLdAzQXktTUG3JKGI5BVNfUFa9kbSFAtXvoIvZ5quILjK1VL9iriW5aPvc HbH3V8t3VRHpKgkYU0PFCEyHs+4ttqnVZRkYe0wT3MdxYaNuw45m73XMV4ontEBdQ8P4HBORDVGtZ il2Prcdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYRjj-0000000BkLr-2oKZ; Mon, 29 Jul 2024 14:52:31 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYRPM-0000000BcD8-1LHk for linux-arm-kernel@lists.infradead.org; Mon, 29 Jul 2024 14:31:29 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AAD11143D; Mon, 29 Jul 2024 07:31:52 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 341B13F64C; Mon, 29 Jul 2024 07:31:26 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: akos.denke@arm.com, andre.przywara@arm.com, luca.fancellu@arm.com, mark.rutland@arm.com, maz@kernel.org Subject: [BOOT-WRAPPER 3/3] configure: allow the use of bare-metal toolchains Date: Mon, 29 Jul 2024 15:31:16 +0100 Message-Id: <20240729143116.1804615-4-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240729143116.1804615-1-mark.rutland@arm.com> References: <20240729143116.1804615-1-mark.rutland@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240729_073128_422460_5C81902F X-CRM114-Status: GOOD ( 11.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently it is not possible to build the boot-wrapper with a bare-metal toolchain, as the configure script tries to build a hosted object. For example, trying to build with the bare-metal aarch64-linux GCC 13.2.0 toolchain from kernel.org fails with: | [mark@lakrids:~/src/boot-wrapper-aarch64]% usekorg 13.2.0 ./configure --enable-gicv3 --host=aarch64-linux --with-kernel-dir=../linux --with-cmdline="console=ttyAMA0 earlycon=pl011,0x1c090000 root=/dev/vda kvm_arm.mode=vhe" | checking for a BSD-compatible install... /usr/bin/install -c | checking whether build environment is sane... yes | checking for aarch64-linux-strip... aarch64-linux-strip | checking for a thread-safe mkdir -p... /usr/bin/mkdir -p | checking for gawk... gawk | checking whether make sets $(MAKE)... yes | checking whether make supports nested variables... yes | checking whether DTB file exists... yes | checking whether kernel image exists... yes | checking for aarch64-linux-gcc... aarch64-linux-gcc | checking whether the C compiler works... no | configure: error: in `/home/mark/src/boot-wrapper-aarch64': | configure: error: C compiler cannot create executables | See `config.log' for more details This behaviour was an unintentional side-effect of moving to autotools in commit: bae4ae6a834cd15b ("Add autotools configuration.") ... as the default CFLAGS end up trying to build a hosted object. Pass the necessary CFLAGS to build a bare-metal object. matching what we do in Makefile.am, so that the configure script doesn't reject bare-metal toolchains. Signed-off-by: Mark Rutland Cc: Andre Przywara Cc: Akos Denke Cc: Luca Fancellu Cc: Marc Zyngier --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index ce41dae..1f2f4f6 100644 --- a/configure.ac +++ b/configure.ac @@ -128,6 +128,9 @@ AC_ARG_ENABLE([gicv3], AM_CONDITIONAL([GICV3], [test "x$USE_GICV3" = "xyes"]) AS_IF([test "x$USE_GICV3" = "xyes"], [], [USE_GICV3=no]) +# Ensure AC_PROG_CC tries to build a bare-metal object +CFLAGS="${CFLAGS} -ffreestanding -nostdlib" + # Ensure that we have all the needed programs AC_PROG_CC AC_PROG_CPP