Fix support for biarch compilers and cross cflags
cover Fix support for biarch compilers and cross cflags
This series fixes two bugs with configure's cross compilation detection:
- first, --cross-cflags is not obeyed by pc-bios/ compilation
- second, on a ppc64le machine, the host compiler can be used for ppc64 tests/tcg; however, this is not being done because $cpu does not match the target. Likewise, on an x86_64 machine the host compiler can be used to build both i386 tests/tcg and pc-bios/optionrom, but the special casing done by the configure script only covers the latter.
The two are related because, if only the first was fixed, pc-bios/optionrom would use either the i386 or the x86_64 cflags depending on which cross compiler was found. So patches 2-4 tackle not just the cross CFLAGS problem with pc-bios, but also the biarch compiler problem with i386 and ppc. Patch 5 then covers the other biarch compilers.
The other two patches are just cleanups.
Supersedes: <[email protected]>
Paolo Bonzini (6):
pc-bios/optionrom: use -m16 unconditionally
configure, pc-bios/optionrom: pass cross CFLAGS correctly configure, pc-bios/s390-ccw: pass cross CFLAGS correctly configure, pc-bios/vof: pass cross CFLAGS correctly
configure: allow more host/target combos to use the host compiler
configure: write EXTRA_CFLAGS for all sub-Makefiles
configure | 50 ++++++++++++++++++----------------- pc-bios/optionrom/Makefile | 15 +---------- pc-bios/optionrom/code16gcc.h | 3 --- pc-bios/s390-ccw/Makefile | 20 +++++++------- pc-bios/s390-ccw/netboot.mak | 6 ++--- pc-bios/vof/Makefile | 8 +++--- 6 files changed, 43 insertions(+), 59 deletions(-) delete mode 100644 pc-bios/optionrom/code16gcc.h
Signature · 1 line
2.36.1
PATCH 1/6 pc-bios/optionrom: use -m16 unconditionally
Remove support for .code16gcc, all supported platforms have -m16.
--- pc-bios/optionrom/Makefile | 15 +-------------- pc-bios/optionrom/code16gcc.h | 3 --- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 pc-bios/optionrom/code16gcc.h
pc-bios/optionrom/Makefile +1 -14
@@ -11,7 +11,7 @@ CFLAGS = -O2 -g quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1)) cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1 && echo OK), $1, $2) -override CFLAGS += -march=i486 -Wall +override CFLAGS += -march=i486 -Wall -m16 # If -fcf-protection is enabled in flags or compiler defaults that will # conflict with -march=i486
@@ -24,21 +24,8 @@ override CFLAGS += $(filter -W%, $(QEMU_CFLAGS)) override CFLAGS += $(call cc-option, -fno-pie) override CFLAGS += -ffreestanding -I$(TOPSRC_DIR)/include override CFLAGS += $(call cc-option, -fno-stack-protector) -override CFLAGS += $(call cc-option, -m16) override CFLAGS += $(call cc-option, -Wno-array-bounds) -ifeq ($(filter -m16, $(CFLAGS)),) -# Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??) -# On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with -# respect to the rest of the code. clang does not have -fno-toplevel-reorder, -# but it places all asm blocks at the beginning and we're relying on it for -# the option ROM header. So just force clang not to use the integrated -# assembler, which doesn't support .code16gcc. -override CFLAGS += $(call cc-option, -fno-toplevel-reorder) -override CFLAGS += $(call cc-option, -no-integrated-as) -override CFLAGS += -m32 -include $(SRC_DIR)/code16gcc.h -endif - Wa = -Wa, override ASFLAGS += -32 override CFLAGS += $(call cc-option, $(Wa)-32)
pc-bios/optionrom/code16gcc.h deleted +0 -3
@@ -1,3 +0,0 @@ -asm( -".code16gcc\n" -);
Signature · 1 line
2.36.1
Re: [PATCH 1/6] pc-bios/optionrom: use -m16 unconditionally
Quoted 8 lines · Paolo Bonzini
Remove support for .code16gcc, all supported platforms have -m16.
Signed-off-by Paolo Bonzini<[email protected]>--- pc-bios/optionrom/Makefile | 15 +-------------- pc-bios/optionrom/code16gcc.h | 3 --- 2 files changed, 1 insertion(+), 17 deletions(-)delete mode 100644
pc-bios/optionrom/code16gcc.h
It was a bit dicey using .code16gcc behind the compiler's back anyway.
r~
PATCH 2/6 configure, pc-bios/optionrom: pass cross CFLAGS correctly
In reply to Paolo BonziniThe optionrom build is disregarding the flags passed to the configure script via --cross-cflags-i386. Pass it down and add it to the Makefile.
This also fixes compilation of TCG i386 tests using an x86_64 compiler.
--- configure | 32 ++++++++++++++++++-------------- pc-bios/optionrom/Makefile | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-)
configure +18 -14
@@ -2057,19 +2057,22 @@ probe_target_compiler() { compute_target_variable $1 target_objcopy objcopy compute_target_variable $1 target_ranlib ranlib compute_target_variable $1 target_strip strip - if test "$1" = $cpu; then - : ${target_cc:=$cc} - : ${target_ccas:=$ccas} - : ${target_as:=$as} - : ${target_ld:=$ld} - : ${target_ar:=$ar} - : ${target_as:=$as} - : ${target_ld:=$ld} - : ${target_nm:=$nm} - : ${target_objcopy:=$objcopy} - : ${target_ranlib:=$ranlib} - : ${target_strip:=$strip} - fi + case "$1:$cpu" in + i386:x86_64 | \ + "$cpu:$cpu") + : ${target_cc:=$cc} + : ${target_ccas:=$ccas} + : ${target_as:=$as} + : ${target_ld:=$ld} + : ${target_ar:=$ar} + : ${target_as:=$as} + : ${target_ld:=$ld} + : ${target_nm:=$nm} + : ${target_objcopy:=$objcopy} + : ${target_ranlib:=$ranlib} + : ${target_strip:=$strip} + ;; + esac if test -n "$target_cc"; then case $1 in i386|x86_64)
@@ -2238,7 +2241,7 @@ done # Mac OS X ships with a broken assembler roms= -probe_target_compilers i386 x86_64 +probe_target_compiler i386 if test -n "$target_cc" && test "$targetos" != "darwin" && test "$targetos" != "sunos" && \ test "$targetos" != "haiku" && test "$softmmu" = yes ; then
@@ -2257,6 +2260,7 @@ if test -n "$target_cc" && echo "# Automatically generated by configure - do not modify" > $config_mak echo "TOPSRC_DIR=$source_path" >> $config_mak echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_mak + echo "EXTRA_CFLAGS=$target_cflags" >> $config_mak write_target_makefile >> $config_mak fi fi
pc-bios/optionrom/Makefile +1 -1
@@ -11,7 +11,7 @@ CFLAGS = -O2 -g quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1)) cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1 && echo OK), $1, $2) -override CFLAGS += -march=i486 -Wall -m16 +override CFLAGS += -march=i486 -Wall $(EXTRA_CFLAGS) -m16 # If -fcf-protection is enabled in flags or compiler defaults that will # conflict with -march=i486
Signature · 1 line
2.36.1
Re: [PATCH 2/6] configure, pc-bios/optionrom: pass cross CFLAGS correctly
pc-bios/optionrom/Makefile CFLAGS = -O2 -g · line 14
Quoted 10 lines · Paolo Bonzini
pc-bios/optionrom/Makefile +1
-1@@ -11,7 +11,7 @@ CFLAGS = -O2 -g quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1)) cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1 && echo OK), $1, $2) -override CFLAGS += -march=i486 -Wall -m16 +override CFLAGS += -march=i486 -Wall $(EXTRA_CFLAGS) -m16
Hmm. I'm not sure about this. Given that EXTRA_CFLAGS is going to be e.g. -m32 or empty, being immediately overwritten to -m16, I don't quite see the point.
It seems like there should be a third cross-compiler "i386_m16" or something, with a different set of cflags at the configure level. Overkill?
r~
Re: [PATCH 2/6] configure, pc-bios/optionrom: pass cross CFLAGS correctly
Quoted 8 lines · Richard Henderson
Quoted 7 lines · Paolo Bonzini
pc-bios/optionrom/Makefile +0
-0@@ -11,7 +11,7 @@ CFLAGS = -O2 -g quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))cc-option = $(if $(shell $(CC) $1 -c -o
/dev/null-xc/dev/null
Quoted 5 lines
pc-bios/optionrom/Makefile CFLAGS = -O2 -g · line 14
Quoted 3 lines
Quoted 1 line
/dev/null2>&1 && echo OK), $1, $2)pc-bios/optionrom/Makefile +1
-1-override CFLAGS += -march=i486 -Wall -m16 +override CFLAGS += -march=i486 -Wall $(EXTRA_CFLAGS) -m16Hmm. I'm not sure about this. Given that
EXTRA_CFLAGSis going to be e.g. -m32 or empty, being immediately overwritten to -m16, I don't quite see the point.
I added it mostly for consistency with the other pc-bios subdirectories, and because it can also be overridden with --cross-cflags-i386 though.
Even for the default -m32, however, there would be a reason to have $(EXTRA_FLAGS) in there. I have played with removing the direct use of "ld -m" in the build of pc-bios/optionrom, and stumbled on a weird GCC configuration issue. The problem is that some hosts pick the right linker emulation when given -m16, but others don't:
$ gcc -dumpspecs
...
*link:
... %{m16|m32|mx32:;:-m elf_x86_64} %{m16|m32:-m elf_i386}# x86_64-w64-mingw32-gcc
...
*link:
%{!m32:-m i386pep} %{m32:-m i386pe} ...The error is in GCC's gcc/config/i386/mingw-w64.h, which provides a MULTILIB_DEFAULTS #define but does not rely on it:
#undef SPEC_32
#undef SPEC_64
#if TARGET_64BIT_DEFAULT
#define SPEC_32 "m32" // should be m16|m32
#define SPEC_64 "!m32" // should be m64
#else
#define SPEC_32 "!m64" // should be m16|m32
#define SPEC_64 "m64"
#endif
So you need -m32 -m16 on 64-bit hosts! For the "working" specs the -m16 would override -m32, while on the broken ones -m32 is for the linker and -m16 is for the compiler.
Paolo
PATCH 3/6 configure, pc-bios/s390-ccw: pass cross CFLAGS correctly
In reply to Paolo BonziniQEMU_CFLAGS is not available in pc-bios/s390-ccw/netboot.mak, but the Makefile needs to access the flags passed to the configure script for the s390x cross compiler. Fix everything and rename QEMU_CFLAGS to EXTRA_CFLAGS for consistency with tests/tcg.
--- configure | 1 + pc-bios/s390-ccw/Makefile | 20 ++++++++++---------- pc-bios/s390-ccw/netboot.mak | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-)
configure +1 -0
@@ -2290,6 +2290,7 @@ if test -n "$target_cc" && test "$softmmu" = yes; then config_mak=pc-bios/s390-ccw/config-host.mak echo "# Automatically generated by configure - do not modify" > $config_mak echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak + echo "EXTRA_CFLAGS=$target_cflags" >> $config_mak write_target_makefile >> $config_mak # SLOF is required for building the s390-ccw firmware on s390x, # since it is using the libnet code from SLOF for network booting.
pc-bios/s390-ccw/Makefile +10 -10
@@ -18,11 +18,11 @@ $(call set-vpath, $(SRC_PATH)) QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d %.o: %.c - $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \ + $(call quiet-command,$(CC) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \ -c -o $@ $<,"CC","$(TARGET_DIR)$@") %.o: %.S - $(call quiet-command,$(CCAS) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \ + $(call quiet-command,$(CCAS) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \ -c -o $@ $<,"CCAS","$(TARGET_DIR)$@") .PHONY : all clean build-all
@@ -30,14 +30,14 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o -QEMU_CFLAGS := -Wall $(filter -W%, $(QEMU_CFLAGS)) -QEMU_CFLAGS += $(call cc-option,-Werror $(QEMU_CFLAGS),-Wno-stringop-overflow) -QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE -QEMU_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables -QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) -QEMU_CFLAGS += -msoft-float -QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS),-march=z900,-march=z10) -QEMU_CFLAGS += -std=gnu99 +EXTRA_CFLAGS := $(EXTRA_CFLAGS) -Wall +EXTRA_CFLAGS += $(call cc-option,-Werror $(EXTRA_CFLAGS),-Wno-stringop-overflow) +EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE +EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables +EXTRA_CFLAGS += $(call cc-option, $(EXTRA_CFLAGS), -fno-stack-protector) +EXTRA_CFLAGS += -msoft-float +EXTRA_CFLAGS += $(call cc-option, $(EXTRA_CFLAGS),-march=z900,-march=z10) +EXTRA_CFLAGS += -std=gnu99 LDFLAGS += -Wl,-pie -nostdlib build-all: s390-ccw.img s390-netboot.img
pc-bios/s390-ccw/netboot.mak +3 -3
@@ -8,7 +8,7 @@ LIBNET_INC := -I$(SLOF_DIR)/lib/libnet NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000 -$(NETOBJS): QEMU_CFLAGS += $(LIBC_INC) $(LIBNET_INC) +$(NETOBJS): EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC) s390-netboot.elf: $(NETOBJS) libnet.a libc.a $(call quiet-command,$(CC) $(NETLDFLAGS) -o $@ $^,"BUILD","$(TARGET_DIR)$@")
@@ -18,7 +18,7 @@ s390-netboot.img: s390-netboot.elf # libc files: -LIBC_CFLAGS = $(QEMU_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ +LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ -MMD -MP -MT $@ -MF $(@:%.o=%.d) CTYPE_OBJS = isdigit.o isxdigit.o toupper.o
@@ -52,7 +52,7 @@ libc.a: $(LIBCOBJS) LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \ dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o -LIBNETCFLAGS = $(QEMU_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ +LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ -DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d) %.o : $(SLOF_DIR)/lib/libnet/%.c
Signature · 1 line
2.36.1
Re: [PATCH 3/6] configure, pc-bios/s390-ccw: pass cross CFLAGS correctly
Quoted 11 lines · Paolo Bonzini
QEMU_CFLAGSis not available in pc-bios/s390-ccw/netboot.mak, but theMakefileneeds to access the flags passed to the configure script for the s390x cross compiler. Fix everything and renameQEMU_CFLAGStoEXTRA_CFLAGSfor consistency with tests/tcg.Signed-off-by Paolo Bonzini <[email protected]>--- configure | 1 + pc-bios/s390-ccw/Makefile | 20 ++++++++++---------- pc-bios/s390-ccw/netboot.mak | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-)
PATCH 4/6 configure, pc-bios/vof: pass cross CFLAGS correctly
In reply to Paolo BonziniUse the flags passed to the configure script for the ppc cross compiler, which in fact default to those that are needed to get the 32-bit ISA. Add the endianness flag so that it remains possible to use a ppc64le compiler to compile VOF.
This also fixes compilation of TCG tests using a biarch compiler, for example ppc64 tests on ppc64le.
--- configure | 13 ++++--------- pc-bios/vof/Makefile | 8 +++----- 2 files changed, 7 insertions(+), 14 deletions(-)
configure +4 -9
@@ -1858,7 +1858,7 @@ fi : ${cross_cc_hexagon="hexagon-unknown-linux-musl-clang"} : ${cross_cc_cflags_hexagon="-mv67 -O2 -static"} : ${cross_cc_cflags_i386="-m32"} -: ${cross_cc_cflags_ppc="-m32"} +: ${cross_cc_cflags_ppc="-m32 -mbig-endian"} : ${cross_cc_cflags_ppc64="-m64 -mbig-endian"} : ${cross_cc_ppc64le="$cross_cc_ppc64"} : ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
@@ -2059,6 +2059,7 @@ probe_target_compiler() { compute_target_variable $1 target_strip strip case "$1:$cpu" in i386:x86_64 | \ + ppc*:ppc64 | \ "$cpu:$cpu") : ${target_cc:=$cc} : ${target_ccas:=$ccas}
@@ -2084,13 +2085,6 @@ probe_target_compiler() { fi } -probe_target_compilers() { - for i; do - probe_target_compiler $i - test -n "$target_cc" && return 0 - done -} - write_target_makefile() { if test -n "$target_cc"; then echo "CC=$target_cc"
@@ -2265,12 +2259,13 @@ if test -n "$target_cc" && fi fi -probe_target_compilers ppc ppc64 +probe_target_compiler ppc if test -n "$target_cc" && test "$softmmu" = yes; then roms="$roms pc-bios/vof" config_mak=pc-bios/vof/config.mak echo "# Automatically generated by configure - do not modify" > $config_mak echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak + echo "EXTRA_CFLAGS=$target_cflags" >> $config_mak write_target_makefile >> $config_mak fi
pc-bios/vof/Makefile +3 -5
@@ -2,15 +2,13 @@ include config.mak VPATH=$(SRC_DIR) all: vof.bin -CC ?= $(CROSS)gcc -LD ?= $(CROSS)ld -OBJCOPY ?= $(CROSS)objcopy +EXTRA_CFLAGS += -mcpu=power4 %.o: %.S - $(CC) -m32 -mbig-endian -mcpu=power4 -c -o $@ $< + $(CC) $(EXTRA_CFLAGS) -c -o $@ $< %.o: %.c - $(CC) -m32 -mbig-endian -mcpu=power4 -c -fno-stack-protector -o $@ $< + $(CC) $(EXTRA_CFLAGS) -c -fno-stack-protector -o $@ $< vof.elf: entry.o main.o ci.o bootmem.o libc.o $(LD) -nostdlib -e_start -T$(SRC_DIR)/vof.lds -EB -o $@ $^
Signature · 1 line
2.36.1
Re: [PATCH 4/6] configure, pc-bios/vof: pass cross CFLAGS correctly
Quoted 10 lines · Paolo Bonzini
Use the flags passed to the configure script for the ppc cross compiler, which in fact default to those that are needed to get the 32-bit ISA. Add the endianness flag so that it remains possible to use a ppc64le compiler to compile VOF.
This also fixes compilation of TCG tests using a biarch compiler, for example ppc64 tests on ppc64le.
Reported-by Matheus Ferst <[email protected]Signed-off-by Paolo Bonzini <[email protected]>
Probably you missed this, but last night (gmt-7) I sent:
make[1]: Entering directory `/home/rth/qemu/bld/pc-bios/vof'
cc -m32 -mbig-endian -mcpu=power4 -c -o entry.o /home/rth/qemu/src/pc-bios/vof/entry.S
cc1: error: ‘-m32’ not supported in this configuration
make[1]: *** [entry.o] Error 1
This with a compiler I built myself,
$ cc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/rth/gcc/run/libexec/gcc/powerpc64le-unknown-linux-gnu/11.0.1/lto-wrapper
Target: powerpc64le-unknown-linux-gnu
Configured with: ../git-gcc/configure --prefix=/home/rth/gcc/run
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.1 20210321 (experimental) [master revision 19ff0b0:fca73fc:6af7b307f659a4f1845a9efd36ca37899515e234] (GCC)
With default configure options, gcc is not biarch.
It would be good to probe whether EXTRA_CFLAGS is actually usable.
r~
PATCH 5/6 configure: allow more host/target combos to use the host compiler
In reply to Paolo BonziniAdd more pairs of bi-arch compilers, so that it is not necessary to have e.g. both little-endian and big-endian ARM compilers.
--- configure | 4 ++++ 1 file changed, 4 insertions(+)
configure +4 -0
@@ -2058,8 +2058,12 @@ probe_target_compiler() { compute_target_variable $1 target_ranlib ranlib compute_target_variable $1 target_strip strip case "$1:$cpu" in + aarch64_be:aarch64 | \ + armeb:arm | \ i386:x86_64 | \ + mips*:mips64 | \ ppc*:ppc64 | \ + sparc:sparc64 | \ "$cpu:$cpu") : ${target_cc:=$cc} : ${target_ccas:=$ccas}
Signature · 1 line
2.36.1
PATCH 6/6 configure: write EXTRA_CFLAGS for all sub-Makefiles
In reply to Paolo BonziniMove the EXTRA_CFLAGS line from the individual subdirectory blocks to the common write_target_makefile and write_container_target_makefile shell functions.
--- configure | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
configure +2 -4
@@ -2090,6 +2090,7 @@ probe_target_compiler() { } write_target_makefile() { + echo "EXTRA_CFLAGS=$target_cflags" if test -n "$target_cc"; then echo "CC=$target_cc" echo "CCAS=$target_ccas"
@@ -2118,6 +2119,7 @@ write_target_makefile() { } write_container_target_makefile() { + echo "EXTRA_CFLAGS=$target_cflags" if test -n "$container_cross_cc"; then echo "CC=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --" echo "CCAS=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
@@ -2258,7 +2260,6 @@ if test -n "$target_cc" && echo "# Automatically generated by configure - do not modify" > $config_mak echo "TOPSRC_DIR=$source_path" >> $config_mak echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_mak - echo "EXTRA_CFLAGS=$target_cflags" >> $config_mak write_target_makefile >> $config_mak fi fi
@@ -2269,7 +2270,6 @@ if test -n "$target_cc" && test "$softmmu" = yes; then config_mak=pc-bios/vof/config.mak echo "# Automatically generated by configure - do not modify" > $config_mak echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak - echo "EXTRA_CFLAGS=$target_cflags" >> $config_mak write_target_makefile >> $config_mak fi
@@ -2289,7 +2289,6 @@ if test -n "$target_cc" && test "$softmmu" = yes; then config_mak=pc-bios/s390-ccw/config-host.mak echo "# Automatically generated by configure - do not modify" > $config_mak echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak - echo "EXTRA_CFLAGS=$target_cflags" >> $config_mak write_target_makefile >> $config_mak # SLOF is required for building the s390-ccw firmware on s390x, # since it is using the libnet code from SLOF for network booting.
@@ -2604,7 +2603,6 @@ for target in $target_list; do if test $got_cross_cc = yes; then mkdir -p tests/tcg/$target echo "QEMU=$PWD/$qemu" >> $config_target_mak - echo "EXTRA_CFLAGS=$target_cflags" >> $config_target_mak echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile tcg_tests_targets="$tcg_tests_targets $target" fi
Signature · 1 line
2.36.1
Quoted 6 lines · Paolo Bonzini
This series fixes two bugs with configure's cross compilation detection:
- first, --cross-cflags is not obeyed by pc-bios/ compilation
- second, on a ppc64le machine, the host compiler can be used for ppc64 tests/tcg;
That may be true for the compiler, but the complete toolchain is usually single endian. For instance, Debian/Ubuntu, Fedora, and FreeBSD lack libc and crt*.o for the foreign endianness. So we'd be able to build ppc64-softmmu tests (which are not upstream yet) but not ppc64-linux-user in ppc64le hosts.
Quoted 30 lines
however, this is not being done because $cpu does not
match the target. Likewise, on anx86_64machine the host compiler can be used to build both i386 tests/tcg and pc-bios/optionrom, but the special casing done by the configure script only covers the latter.The two are related because, if only the first was fixed, pc-bios/optionrom would use either the i386 or the
x86_64cflags depending on which cross compiler was found. So patches 2-4 tackle not just the cross CFLAGS problem with pc-bios, but also the biarch compiler problem with i386 and ppc. Patch 5 then covers the other biarch compilers.The other two patches are just cleanups.
Supersedes: <[email protected]>
Paolo Bonzini (6):
pc-bios/optionrom: use -m16 unconditionally
configure, pc-bios/optionrom: pass cross CFLAGS correctly configure, pc-bios/s390-ccw: pass cross CFLAGS correctly configure, pc-bios/vof: pass cross CFLAGS correctly
configure: allow more host/target combos to use the host compiler
configure: writeEXTRA_CFLAGSfor all sub-Makefilesconfigure | 50 ++++++++++++++++++----------------- pc-bios/optionrom/Makefile | 15 +---------- pc-bios/optionrom/code16gcc.h | 3 --- pc-bios/s390-ccw/Makefile | 20 +++++++------- pc-bios/s390-ccw/netboot.mak | 6 ++--- pc-bios/vof/Makefile | 8 +++--- 6 files changed, 43 insertions(+), 59 deletions(-)
Quoted 6 lines
delete mode 100644
pc-bios/optionrom/code16gcc.h--
2.36.1
Thanks,
Matheus K. Ferst
Instituto de Pesquisas ELDORADO <http://www.eldorado.org.br/>
Analista de Software
Aviso Legal - Disclaimer <https://www.eldorado.org.br/disclaimer.html>