From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: qemu-devel@nongnu.org
Cc: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Thomas Huth" <thuth@redhat.com>
Subject: [PATCH] configure: do not require gcc runtime library for firmwares
Date: Fri, 16 Feb 2024 19:12:17 +0100 [thread overview]
Message-ID: <20240216181238.262772-1-marmarek@invisiblethingslab.com> (raw)
probe_target_compiler() when checking for multilib support checks if
-nostdlib works together with -lgcc. It isn't necessary for building
various components in pc-bios/optionrom, as evidenced by looking at
actually used link flags there.
Alpine Linux for x86_64 does not ship with 32bit libgcc, but its gcc is
otherwise perfectly capable of building firmwares in pc-bios/optionrom
dir. Make configure recognize this situation.
Keep requiring functional -lgcc in other places.
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
configure | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/configure b/configure
index ff058d6c48..7721999f49 100755
--- a/configure
+++ b/configure
@@ -1216,7 +1216,7 @@ have_target() {
return 1
}
-# probe_target_compiler TARGET
+# probe_target_compiler TARGET [nostdlib-extra-ldflags]
#
# Look for a compiler for the given target, either native or cross.
# Set variables target_* if a compiler is found, and container_cross_*
@@ -1226,6 +1226,9 @@ have_target() {
#
# If TARGET is a user-mode emulation target, also set build_static to
# "y" if static linking is possible.
+# When testing -nostdlib build, -lgcc will be added for more extensive multilib
+# support test, but the -lgcc can be overriden with the second argument to the
+# function.
#
probe_target_compiler() {
# reset all output variables
@@ -1243,6 +1246,7 @@ probe_target_compiler() {
container_cross_strip=
target_arch=${1%%-*}
+ nostdlib_ldflags=${2--lgcc}
case $target_arch in
aarch64) container_hosts="x86_64 aarch64" ;;
alpha) container_hosts=x86_64 ;;
@@ -1432,7 +1436,7 @@ probe_target_compiler() {
case $1 in
*-softmmu)
if do_compiler "$target_cc" $target_cflags -o $TMPO -c $TMPC &&
- do_compiler "$target_cc" $target_cflags -r -nostdlib -o "${TMPDIR1}/${TMPB}2.o" "$TMPO" -lgcc; then
+ do_compiler "$target_cc" $target_cflags -r -nostdlib -o "${TMPDIR1}/${TMPB}2.o" "$TMPO" $nostdlib_ldflags; then
got_cross_cc=yes
break
fi
@@ -1544,7 +1548,7 @@ echo "# Automatically generated by configure - do not modify" > Makefile.prereqs
if have_target i386-softmmu x86_64-softmmu && \
test "$host_os" != "darwin" && test "$host_os" != "sunos" && \
test "$host_os" != "haiku" && \
- probe_target_compiler i386-softmmu; then
+ probe_target_compiler i386-softmmu ""; then
subdirs="$subdirs pc-bios/optionrom"
config_mak=pc-bios/optionrom/config.mak
echo "# Automatically generated by configure - do not modify" > $config_mak
--
2.43.0
next reply other threads:[~2024-02-16 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 18:12 Marek Marczykowski-Górecki [this message]
2024-02-19 16:12 ` [PATCH] configure: do not require gcc runtime library for firmwares Michael Tokarev
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=20240216181238.262772-1-marmarek@invisiblethingslab.com \
--to=marmarek@invisiblethingslab.com \
--cc=alex.bennee@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).