Message ID | 20190730123759.21723-2-pbonzini@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tests/tcg: disentangle makefiles | expand |
Paolo Bonzini <pbonzini@redhat.com> writes: > For i386 specifically, this allows using the host GCC > to compile the i386 tests. But, it should really be > done for all targets, unless we want to pass $(EXTRA_CFLAGS) > directly as part of $(CC). Hmm well for softmmu the tests take the decision: # For softmmu targets we include a different Makefile fragement as the # build options for bare programs are usually pretty different. They # are expected to provide their own build recipes. So we are not expecting to handle multi-classing the system compiler to generate different binaries with a common build string. To be honest I wonder if we should just drop the EXTRA_CFLAGS shenanigans in favour of an explicit compiler per target? > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > tests/tcg/aarch64/Makefile.softmmu-target | 4 ++-- > tests/tcg/alpha/Makefile.softmmu-target | 4 ++-- > tests/tcg/arm/Makefile.softmmu-target | 2 +- > tests/tcg/i386/Makefile.softmmu-target | 4 ++-- > tests/tcg/minilib/Makefile.target | 2 +- > tests/tcg/xtensa/Makefile.softmmu-target | 4 ++-- > 6 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target > index 2e560e4..4c4aaf6 100644 > --- a/tests/tcg/aarch64/Makefile.softmmu-target > +++ b/tests/tcg/aarch64/Makefile.softmmu-target > @@ -22,11 +22,11 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc > .PRECIOUS: $(CRT_OBJS) > > %.o: $(CRT_PATH)/%.S > - $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@ > + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ > > # Build and link the tests > %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) > - $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) > + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) > > memory: CFLAGS+=-DCHECK_UNALIGNED=1 > > diff --git a/tests/tcg/alpha/Makefile.softmmu-target b/tests/tcg/alpha/Makefile.softmmu-target > index 3c0f34c..09193a6 100644 > --- a/tests/tcg/alpha/Makefile.softmmu-target > +++ b/tests/tcg/alpha/Makefile.softmmu-target > @@ -22,11 +22,11 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc > .PRECIOUS: $(CRT_OBJS) > > %.o: $(CRT_PATH)/%.S > - $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@ > + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ > > # Build and link the tests > %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) > - $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) > + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) > > memory: CFLAGS+=-DCHECK_UNALIGNED=0 > > diff --git a/tests/tcg/arm/Makefile.softmmu-target b/tests/tcg/arm/Makefile.softmmu-target > index 49d48d8..2deb06e 100644 > --- a/tests/tcg/arm/Makefile.softmmu-target > +++ b/tests/tcg/arm/Makefile.softmmu-target > @@ -18,7 +18,7 @@ CFLAGS+=-Wl,--build-id=none -x assembler-with-cpp > LDFLAGS+=-nostdlib -N -static > > %: %.S %.ld > - $(CC) $(CFLAGS) $(ASFLAGS) $< -o $@ $(LDFLAGS) -T $(ARM_SRC)/$@.ld > + $(CC) $(CFLAGS) $(ASFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) -T $(ARM_SRC)/$@.ld > > # Specific Test Rules > > diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target > index 0a43648..cee3420 100644 > --- a/tests/tcg/i386/Makefile.softmmu-target > +++ b/tests/tcg/i386/Makefile.softmmu-target > @@ -32,11 +32,11 @@ TESTS+=$(MULTIARCH_TESTS) > .PRECIOUS: $(CRT_OBJS) > > %.o: $(CRT_PATH)/%.S > - $(CC) $(CFLAGS) -c $< -o $@ > + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ > > # Build and link the tests > %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) > - $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) > + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) > > memory: CFLAGS+=-DCHECK_UNALIGNED=1 > > diff --git a/tests/tcg/minilib/Makefile.target b/tests/tcg/minilib/Makefile.target > index 3ed8077..c821d28 100644 > --- a/tests/tcg/minilib/Makefile.target > +++ b/tests/tcg/minilib/Makefile.target > @@ -18,4 +18,4 @@ MINILIB_INC=-isystem $(SYSTEM_MINILIB_SRC) > .PRECIOUS: $(MINILIB_OBJS) > > %.o: $(SYSTEM_MINILIB_SRC)/%.c > - $(CC) $(CFLAGS) -c $< -o $@ > + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ > diff --git a/tests/tcg/xtensa/Makefile.softmmu-target b/tests/tcg/xtensa/Makefile.softmmu-target > index 8212d96..9530cac 100644 > --- a/tests/tcg/xtensa/Makefile.softmmu-target > +++ b/tests/tcg/xtensa/Makefile.softmmu-target > @@ -34,9 +34,9 @@ $(XTENSA_USABLE_TESTS): linker.ld macros.inc $(CRT) Makefile.softmmu-target > > # special rule for common blobs > %.o: %.S > - $(CC) $(XTENSA_INC) $($*_ASFLAGS) $(ASFLAGS) -c $< -o $@ > + $(CC) $(XTENSA_INC) $($*_ASFLAGS) $(ASFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ > > %: %.S > - $(CC) $(XTENSA_INC) $(ASFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT) > + $(CC) $(XTENSA_INC) $(ASFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT) > > endif -- Alex Bennée
On 07/08/19 14:51, Alex Bennée wrote: >> For i386 specifically, this allows using the host GCC >> to compile the i386 tests. But, it should really be >> done for all targets, unless we want to pass $(EXTRA_CFLAGS) >> directly as part of $(CC). > Hmm well for softmmu the tests take the decision: > > # For softmmu targets we include a different Makefile fragement as the > # build options for bare programs are usually pretty different. They > # are expected to provide their own build recipes. > > So we are not expecting to handle multi-classing the system compiler to > generate different binaries with a common build string. We almost do, since we have case "$cpu" in i386) CPU_CFLAGS="-m32" LDFLAGS="-m32 $LDFLAGS" cross_cc_i386=$cc cross_cc_cflags_i386="$CPU_CFLAGS" So you can compile with "./configure --cpu=i386" and have it use "gcc -m32" as a cross compiler on x86_64, also for TCG tests. So it seemed half-baked to me. > To be honest I > wonder if we should just drop the EXTRA_CFLAGS shenanigans in favour of > an explicit compiler per target? I don't know. I think supporting "gcc -m32" on x86_64 is a good idea though. Yet another possibility is to use "--cross-cc-i386='gcc -m32'" directly, but that would be a separate patch. For these I really wanted to have no semantic change. Paolo
diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target index 2e560e4..4c4aaf6 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -22,11 +22,11 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc .PRECIOUS: $(CRT_OBJS) %.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) - $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) memory: CFLAGS+=-DCHECK_UNALIGNED=1 diff --git a/tests/tcg/alpha/Makefile.softmmu-target b/tests/tcg/alpha/Makefile.softmmu-target index 3c0f34c..09193a6 100644 --- a/tests/tcg/alpha/Makefile.softmmu-target +++ b/tests/tcg/alpha/Makefile.softmmu-target @@ -22,11 +22,11 @@ LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc .PRECIOUS: $(CRT_OBJS) %.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) - $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) memory: CFLAGS+=-DCHECK_UNALIGNED=0 diff --git a/tests/tcg/arm/Makefile.softmmu-target b/tests/tcg/arm/Makefile.softmmu-target index 49d48d8..2deb06e 100644 --- a/tests/tcg/arm/Makefile.softmmu-target +++ b/tests/tcg/arm/Makefile.softmmu-target @@ -18,7 +18,7 @@ CFLAGS+=-Wl,--build-id=none -x assembler-with-cpp LDFLAGS+=-nostdlib -N -static %: %.S %.ld - $(CC) $(CFLAGS) $(ASFLAGS) $< -o $@ $(LDFLAGS) -T $(ARM_SRC)/$@.ld + $(CC) $(CFLAGS) $(ASFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) -T $(ARM_SRC)/$@.ld # Specific Test Rules diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target index 0a43648..cee3420 100644 --- a/tests/tcg/i386/Makefile.softmmu-target +++ b/tests/tcg/i386/Makefile.softmmu-target @@ -32,11 +32,11 @@ TESTS+=$(MULTIARCH_TESTS) .PRECIOUS: $(CRT_OBJS) %.o: $(CRT_PATH)/%.S - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ # Build and link the tests %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) - $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) memory: CFLAGS+=-DCHECK_UNALIGNED=1 diff --git a/tests/tcg/minilib/Makefile.target b/tests/tcg/minilib/Makefile.target index 3ed8077..c821d28 100644 --- a/tests/tcg/minilib/Makefile.target +++ b/tests/tcg/minilib/Makefile.target @@ -18,4 +18,4 @@ MINILIB_INC=-isystem $(SYSTEM_MINILIB_SRC) .PRECIOUS: $(MINILIB_OBJS) %.o: $(SYSTEM_MINILIB_SRC)/%.c - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ diff --git a/tests/tcg/xtensa/Makefile.softmmu-target b/tests/tcg/xtensa/Makefile.softmmu-target index 8212d96..9530cac 100644 --- a/tests/tcg/xtensa/Makefile.softmmu-target +++ b/tests/tcg/xtensa/Makefile.softmmu-target @@ -34,9 +34,9 @@ $(XTENSA_USABLE_TESTS): linker.ld macros.inc $(CRT) Makefile.softmmu-target # special rule for common blobs %.o: %.S - $(CC) $(XTENSA_INC) $($*_ASFLAGS) $(ASFLAGS) -c $< -o $@ + $(CC) $(XTENSA_INC) $($*_ASFLAGS) $(ASFLAGS) $(EXTRA_CFLAGS) -c $< -o $@ %: %.S - $(CC) $(XTENSA_INC) $(ASFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT) + $(CC) $(XTENSA_INC) $(ASFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) $(NOSTDFLAGS) $(CRT) endif
For i386 specifically, this allows using the host GCC to compile the i386 tests. But, it should really be done for all targets, unless we want to pass $(EXTRA_CFLAGS) directly as part of $(CC). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- tests/tcg/aarch64/Makefile.softmmu-target | 4 ++-- tests/tcg/alpha/Makefile.softmmu-target | 4 ++-- tests/tcg/arm/Makefile.softmmu-target | 2 +- tests/tcg/i386/Makefile.softmmu-target | 4 ++-- tests/tcg/minilib/Makefile.target | 2 +- tests/tcg/xtensa/Makefile.softmmu-target | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-)