From: Mark Rutland <mark.rutland@arm.com>
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 [thread overview]
Message-ID: <20240729143116.1804615-4-mark.rutland@arm.com> (raw)
In-Reply-To: <20240729143116.1804615-1-mark.rutland@arm.com>
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 <mark.rutland@arm.com>
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Akos Denke <akos.denke@arm.com>
Cc: Luca Fancellu <luca.fancellu@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
---
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
--
2.30.2
next prev parent reply other threads:[~2024-07-29 14:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-29 14:31 [BOOT-WRAPPER 0/3] Allow use of bare-metal toolchains Mark Rutland
2024-07-29 14:31 ` [BOOT-WRAPPER 1/3] Makefile: rework test-dtc-option Mark Rutland
2024-07-29 14:31 ` [BOOT-WRAPPER 2/3] Makefile: suppress RWX segment warnings Mark Rutland
2024-07-29 14:31 ` Mark Rutland [this message]
2024-08-02 9:21 ` [BOOT-WRAPPER 0/3] Allow use of bare-metal toolchains Marc Zyngier
2024-08-02 10:10 ` Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240729143116.1804615-4-mark.rutland@arm.com \
--to=mark.rutland@arm.com \
--cc=akos.denke@arm.com \
--cc=andre.przywara@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=luca.fancellu@arm.com \
--cc=maz@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox