From: Roman Bolshakov <r.bolshakov@yadro.com>
To: <kvm@vger.kernel.org>
Cc: Thomas Huth <thuth@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Roman Bolshakov <r.bolshakov@yadro.com>
Subject: [kvm-unit-tests PATCH] configure: Test if compiler supports -m16 on x86
Date: Thu, 24 Sep 2020 21:24:01 +0300 [thread overview]
Message-ID: <20200924182401.95891-1-r.bolshakov@yadro.com> (raw)
-m16 option is available only since GCC 4.9.0 [1]. That causes a build
failure on centos-7 [2] that has GCC 4.8.5.
Fallback to -m32 if -m16 is not available.
1. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59672
2. https://gitlab.com/bonzini/kvm-unit-tests/-/jobs/755368387
Fixes: 2616ad934e2 ("x86: realmode: Workaround clang issues")
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
configure | 11 +++++++++++
x86/Makefile.common | 4 ++++
2 files changed, 15 insertions(+)
diff --git a/configure b/configure
index f930543..7dc2e3b 100755
--- a/configure
+++ b/configure
@@ -16,6 +16,7 @@ pretty_print_stacks=yes
environ_default=yes
u32_long=
wa_divide=
+m16_support=
vmm="qemu"
errata_force=0
erratatxt="$srcdir/errata.txt"
@@ -167,6 +168,15 @@ EOF
rm -f lib-test.{o,S}
fi
+# check if -m16 is supported
+if [ "$arch" = "i386" ] || [ "$arch" = "x86_64" ]; then
+ cat << EOF > lib-test.c
+int f(int a, int b) { return a + b; }
+EOF
+ m16_support=$("$cross_prefix$cc" -m16 -c lib-test.c >/dev/null 2>&1 && echo yes)
+ rm -f lib-test.{o,c}
+fi
+
# require enhanced getopt
getopt -T > /dev/null
if [ $? -ne 4 ]; then
@@ -224,6 +234,7 @@ ENVIRON_DEFAULT=$environ_default
ERRATATXT=$erratatxt
U32_LONG_FMT=$u32_long
WA_DIVIDE=$wa_divide
+M16_SUPPORT=$m16_support
EOF
cat <<EOF > lib/config.h
diff --git a/x86/Makefile.common b/x86/Makefile.common
index 5567d66..553bf49 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -72,7 +72,11 @@ $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o
$(CC) -m32 -nostdlib -o $@ -Wl,-m,elf_i386 \
-Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^
+ifeq ($(M16_SUPPORT),yes)
$(TEST_DIR)/realmode.o: bits = 16
+else
+$(TEST_DIR)/realmode.o: bits = 32
+endif
$(TEST_DIR)/kvmclock_test.elf: $(TEST_DIR)/kvmclock.o
--
2.28.0
next reply other threads:[~2020-09-24 18:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 18:24 Roman Bolshakov [this message]
2020-09-25 6:45 ` [kvm-unit-tests PATCH] configure: Test if compiler supports -m16 on x86 Thomas Huth
2020-09-25 7:17 ` Paolo Bonzini
2020-09-25 9:16 ` Roman Bolshakov
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=20200924182401.95891-1-r.bolshakov@yadro.com \
--to=r.bolshakov@yadro.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.