[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] configure: do not require gcc runtime library for firmwares
From: |
Marek Marczykowski-Górecki |
Subject: |
[PATCH] configure: do not require gcc runtime library for firmwares |
Date: |
Fri, 16 Feb 2024 19:12:17 +0100 |
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
- [PATCH] configure: do not require gcc runtime library for firmwares,
Marek Marczykowski-Górecki <=