On Fri, Sep 25, 2020 at 09:17:00AM +0200, Paolo Bonzini wrote: > On 24/09/20 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> > > This is a simpler way to do it: > > diff --git a/x86/Makefile.common b/x86/Makefile.common > index 5567d66..781dba6 100644 > --- a/x86/Makefile.common > +++ b/x86/Makefile.common > @@ -72,7 +72,7 @@ $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o > $(CC) -m32 -nostdlib -o $@ -Wl,-m,elf_i386 \ > -Wl,-T,$(SRCDIR)/$(TEST_DIR)/realmode.lds $^ > > -$(TEST_DIR)/realmode.o: bits = 16 > +$(TEST_DIR)/realmode.o: bits := $(if $(call cc-option,-m16,""),16,32) > > $(TEST_DIR)/kvmclock_test.elf: $(TEST_DIR)/kvmclock.o > > It's a tiny bit slower because the check is done on every compilation, > but only if realmode.o is stale. > > It passes CI (https://gitlab.com/bonzini/kvm-unit-tests/-/pipelines/194356382) > so I plan to commit it. > That's fine, Reviewed-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx> Thanks, Roman