From patchwork Fri Aug 2 11:17:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 13751476 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 8A201C52D6D for ; Fri, 2 Aug 2024 11:18:28 +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: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:In-Reply-To:References:List-Owner; bh=qEInz4Y/ZchkvnciCPgmhmn5/GR0MrrL5wFw2O7NKjw=; b=elOdxmDT8nGmsJFVNdMI6VpNch zjMRdmviGGliIefUGVGONBO7QZXyD6tokWkrxeLSCIPpLK4lrdTOsWI1TRUKKMv/B5c+lJZqZH+UN Ieq0BB06AtAol5z6L8IghZhfci+e9uRMiLAPqPHx1/FKzm/Xy8IFHG7krJjK9prQ8yhGceXwU/aN/ ahnXgcP5ATerrjRrOxU/BKZQM9o3T5+QKlXLDo9ir1Qzyg4ylGiEYDZAmVngxQQMd3k5jGJeedJh+ unttgGqGhhWqH2hj2u0G91AI+0fZhmk2S1kyxKxo/t1WJRbM57zDRP972JfR093NC6LN5Ux3EX2xQ aePO0d8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZqIX-00000008f8l-3MqF; Fri, 02 Aug 2024 11:18:13 +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 1sZqI2-00000008f2t-21aO for linux-arm-kernel@lists.infradead.org; Fri, 02 Aug 2024 11:17:44 +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 A3C111007; Fri, 2 Aug 2024 04:18:04 -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 185373F64C; Fri, 2 Aug 2024 04:17:37 -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: [PATCH] Revert "configure: allow the use of bare-metal toolchains" Date: Fri, 2 Aug 2024 12:17:29 +0100 Message-Id: <20240802111729.2154293-1-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240802_041742_586492_4264589F X-CRM114-Status: GOOD ( 10.53 ) 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 While well-intentioned, the CFLAGS change to support bare metal toolchains introduced at least two problems: (1) It broke building on an AArch64 host when *not* passing '--host=[...]', as the bare-metal object files built during the configure step can't be executed on the host: | [mark@gravadlaks:~/src/boot-wrapper-aarch64]% ./configure --enable-gicv3 --with-kernel-dir=../linux-kvm | checking for a BSD-compatible install... /usr/bin/install -c | checking whether build environment is sane... yes | checking for a race-free mkdir -p... /usr/bin/mkdir -p | checking for gawk... no | checking for mawk... mawk | 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 gcc... gcc | checking whether the C compiler works... yes | checking for C compiler default output file name... a.out | checking for suffix of executables... | checking whether we are cross compiling... configure: error: in `/home/mark/src/boot-wrapper-aarch64': | configure: error: cannot run C compiled programs. | If you meant to cross compile, use `--host'. | See `config.log' for more details (2) It removed the implicit default CFLAGS used by autoconf ('-g -O2'), and consequently the boot-wrapper was compiled at a lower optimization level. This caused functions to use more stack space, and for CPUs to clobber other CPUs' stacks during initialization, leading to various potential issues including misconfiguration of the system. We can solve (2) by adding '-O2' manually and/or increasing STACK_SIZE from 256 bytes, but (1) is much more painful to solve as we end up having to work around the core design of autoconf. For now, revert the problematic commit. This reverts commit 1fea854771f9aee405c4ae204c0e0f912318da6f. Signed-off-by: Mark Rutland Reported-by: Andre Przywara Cc: Akos Denke Cc: Luca Fancellu Cc: Marc Zyngier --- configure.ac | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1f2f4f6..ce41dae 100644 --- a/configure.ac +++ b/configure.ac @@ -128,9 +128,6 @@ 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