Re: [kvm-unit-tests PATCH] configure: Test if compiler supports -m16 on x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24/09/2020 20.24, Roman Bolshakov wrote:
> -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@xxxxxxxxx>
> ---
>  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
>  
> 

Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux