(Mostly) build system changes for 2022-06-24
The following changes since commit 2b049d2c8dc01de750410f8f1a4eac498c04c723:
Merge tag 'pull-aspeed-20220622' of https://github.com/legoater/qemu into staging (2022-06-22 07:27:06 -0700)
are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to 72da35fec9a9ba91a5b2cb9ee00843a94fa9413d:
accel: kvm: Fix memory leak in find_stats_descriptors (2022-06-24 10:19:17 +0200)
----------------------------------------------------------------
* fuzzing fixes
* fix cross compilation CFLAGS and compiler choice
* do not specify -bios option for tests/vm
* miscellaneous fixes
----------------------------------------------------------------
Alexander Bulekov (2):
build: improve -fsanitize-coverage-allowlist check
fuzz: only use generic-fuzz targets on oss-fuzz
Marc-André Lureau (1):
audio/dbus: fix building
Miaoqian Lin (1):
accel: kvm: Fix memory leak in find_stats_descriptors
Paolo Bonzini (9):
tests/vm: do not specify -bios option 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 tests/tcg: compile system emulation tests as freestanding
build: try both native and cross compilers for linux-user tests
Thomas Huth (1):
meson.build: Require a recent version of libpng
accel/kvm/kvm-all.c | 1 + audio/meson.build | 2 +- configure | 188 ++++++++++++++++++++------------- meson.build | 7 +- 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 +- scripts/oss-fuzz/build.sh | 4 +- tests/tcg/Makefile.target | 1 + tests/tcg/aarch64/system/pauth-3.c | 2 +- tests/tcg/aarch64/system/semiconsole.c | 2 +- tests/tcg/aarch64/system/semiheap.c | 2 +- tests/tcg/multiarch/system/memory.c | 2 +- tests/vm/fedora | 1 - tests/vm/freebsd | 1 - tests/vm/netbsd | 1 - tests/vm/openbsd | 1 - 19 files changed, 143 insertions(+), 124 deletions(-) delete mode 100644 pc-bios/optionrom/code16gcc.h
Signature · 1 line
2.36.1
[PULL 02/14] 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
[PULL 03/14] 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 will make it possible to get the -m32 flag from $target_cflags to force a 32-bit build on 64-bit hosts, instead of supplying manually the arcane -Wa,-32 and linker emulation options.
--- 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
[PULL 09/14] build: try both native and cross compilers for linux-user tests
In reply to Paolo BonziniConfigure is trying to fall back on cross compilers for targets that can have bi-arch or bi-endian toolchains, but there are many corner cases where just checking the name can go wrong. For example, the RHEL ppc64le compiler is bi-arch and bi-endian, but multilibs are disabled. Therefore it cannot be used to build 32-bit hosted binaries like the linux-user TCG tests.
Trying the cross compiler first also does not work, and an example for this is also ppc64le. The powerpc64-linux-gnu-gcc binary from the cross-gcc package is theoretically multilib-friendly, but it cannot find the CRT files on a ppc64le host, because they are not in the .../le multilib subdirectory.
This can be fixed by testing both the native compiler and the cross compiler, and proceeding with the first one that works. To do this, move the compiler usability check from the tests/tcg snippet to inside probe_target_compiler and, while at it, restrict it to just the user-mode emulation tests; if a compiler is not able to build nostdlib freestanding binaries the installation is broken.
--- configure | 166 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 100 insertions(+), 66 deletions(-)
configure +100 -66
@@ -1868,6 +1868,7 @@ fi : ${cross_cc_cflags_x86_64="-m64"} compute_target_variable() { + eval "$2=" if eval test -n "\"\${cross_prefix_$1}\""; then if eval has "\"\${cross_prefix_$1}\$3\""; then eval "$2=\"\${cross_prefix_$1}\$3\""
@@ -1875,8 +1876,21 @@ compute_target_variable() { fi } +# probe_target_compiler TARGET TEST-PROGRAM +# +# Look for a compiler for the given target, either native or cross. +# Set variables target_* if a compiler is found, and container_cross_* +# if a Docker-based cross-compiler image is known for the target. +# Set got_cross_cc to yes/no depending on whether a non-container-based +# compiler was found. +# +# If TEST-PROGRAM is present, use it to test the usability of the +# compiler, and also set build_static to "y" if static linking is +# possible. +# probe_target_compiler() { # reset all output variables + got_cross_cc=no container_image= container_hosts= container_cross_cc=
@@ -1887,14 +1901,6 @@ probe_target_compiler() { container_cross_objcopy= container_cross_ranlib= container_cross_strip= - target_cc= - target_ar= - target_as= - target_ld= - target_nm= - target_objcopy= - target_ranlib= - target_strip= case $1 in aarch64) container_hosts="x86_64 aarch64" ;;
@@ -2041,22 +2047,8 @@ probe_target_compiler() { : ${container_cross_strip:=${container_cross_prefix}strip} done - eval "target_cflags=\${cross_cc_cflags_$1}" - if eval test -n "\"\${cross_cc_$1}\""; then - if eval has "\"\${cross_cc_$1}\""; then - eval "target_cc=\"\${cross_cc_$1}\"" - fi - else - compute_target_variable $1 target_cc gcc - fi - target_ccas=$target_cc - compute_target_variable $1 target_ar ar - compute_target_variable $1 target_as as - compute_target_variable $1 target_ld ld - compute_target_variable $1 target_nm nm - compute_target_variable $1 target_objcopy objcopy - compute_target_variable $1 target_ranlib ranlib - compute_target_variable $1 target_strip strip + local t try + try=cross case "$1:$cpu" in aarch64_be:aarch64 | \ armeb:arm | \
@@ -2065,27 +2057,89 @@ probe_target_compiler() { ppc*:ppc64 | \ sparc:sparc64 | \ "$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} - ;; + try='native cross' ;; esac - if test -n "$target_cc"; then - case $1 in - i386|x86_64) - if $target_cc --version | grep -qi "clang"; then - unset target_cc + eval "target_cflags=\${cross_cc_cflags_$1}" + for t in $try; do + case $t in + native) + target_cc=$cc + target_ccas=$ccas + target_ar=$ar + target_as=$as + target_ld=$ld + target_nm=$nm + target_objcopy=$objcopy + target_ranlib=$ranlib + target_strip=$strip + ;; + cross) + target_cc= + if eval test -n "\"\${cross_cc_$1}\""; then + if eval has "\"\${cross_cc_$1}\""; then + eval "target_cc=\"\${cross_cc_$1}\"" fi - ;; + else + compute_target_variable $1 target_cc gcc + fi + target_ccas=$target_cc + compute_target_variable $1 target_ar ar + compute_target_variable $1 target_as as + compute_target_variable $1 target_ld ld + compute_target_variable $1 target_nm nm + compute_target_variable $1 target_objcopy objcopy + compute_target_variable $1 target_ranlib ranlib + compute_target_variable $1 target_strip strip + ;; esac + + if test -n "$target_cc"; then + case $1 in + i386|x86_64) + if $target_cc --version | grep -qi "clang"; then + continue + fi + ;; + esac + elif test -n "$target_as" && test -n "$target_ld"; then + # Special handling for assembler only targets + case $target in + tricore-softmmu) + build_static= + got_cross_cc=yes + break + ;; + *) + continue + ;; + esac + else + continue + fi + + if test $# = 2 && do_compiler "$target_cc" $target_cflags -o $TMPE $TMPC -static ; then + build_static=y + got_cross_cc=yes + break + fi + if test $# = 1 || do_compiler "$target_cc" $target_cflags -o $TMPE $TMPC ; then + build_static= + got_cross_cc=yes + break + fi + done + if test $got_cross_cc != yes; then + build_static= + target_cc= + target_ccas= + target_cflags= + target_ar= + target_as= + target_ld= + target_nm= + target_objcopy= + target_ranlib= + target_strip= fi }
@@ -2488,9 +2542,10 @@ tcg_tests_targets= for target in $target_list; do arch=${target%%-*} - probe_target_compiler ${arch} config_target_mak=tests/tcg/config-$target.mak + write_c_skeleton + echo "# Automatically generated by configure - do not modify" > $config_target_mak echo "TARGET_NAME=$arch" >> $config_target_mak case $target in
@@ -2501,35 +2556,14 @@ for target in $target_list; do *-softmmu) test -f $source_path/tests/tcg/$arch/Makefile.softmmu-target || continue qemu="qemu-system-$arch" + probe_target_compiler ${arch} ;; *-linux-user|*-bsd-user) qemu="qemu-$arch" + probe_target_compiler ${arch} $TMPC ;; esac - got_cross_cc=no - unset build_static - - if test -n "$target_cc"; then - write_c_skeleton - if ! do_compiler "$target_cc" $target_cflags \ - -o $TMPE $TMPC -static ; then - # For host systems we might get away with building without -static - if do_compiler "$target_cc" $target_cflags \ - -o $TMPE $TMPC ; then - got_cross_cc=yes - fi - else - got_cross_cc=yes - build_static=y - fi - elif test -n "$target_as" && test -n "$target_ld"; then - # Special handling for assembler only tests - case $target in - tricore-softmmu) got_cross_cc=yes ;; - esac - fi - if test $got_cross_cc = yes; then # Test for compiler features for optional tests. We only do this # for cross compilers because ensuring the docker containers based
Signature · 1 line
2.36.1
[PULL 04/14] 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
[PULL 05/14] 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.
--- 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
[PULL 06/14] 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
[PULL 07/14] configure: write EXTRA_CFLAGS for all sub-Makefiles
In reply to Paolo Bonzini--- 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
[PULL 11/14] fuzz: only use generic-fuzz targets on oss-fuzz
In reply to Paolo BonziniFrom: Alexander Bulekov <[email protected]>
The non-generic-fuzz targets often time-out, or run out of memory. Additionally, they create unreproducible bug-reports. It is possible that this is resulting in failing coverage-reports on OSS-Fuzz. In the future, these test-cases should be fixed, or removed.
Message-Id: <[email protected]>
--- scripts/oss-fuzz/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/oss-fuzz/build.sh +2 -2
@@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e # # OSS-Fuzz build script. See: # https://google.github.io/oss-fuzz/getting-started/new-project-guide/#buildsh
@@ -105,7 +105,7 @@ do # to be configured. We have some generic-fuzz-{pc-q35, floppy, ...} targets # that are thin wrappers around this target that set the required # environment variables according to predefined configs. - if [ "$target" != "generic-fuzz" ]; then + if [[ $target == "generic-fuzz-"* ]]; then ln $base_copy \ "$DEST_DIR/qemu-fuzz-i386-target-$target" fi
Signature · 1 line
2.36.1
[PULL 13/14] meson.build: Require a recent version of libpng
In reply to Paolo BonziniFrom: Thomas Huth <[email protected]>
According to https://gitlab.com/qemu-project/qemu/-/issues/1080#note_998088246
QEMU does not compile with older versions of libpng, so we should check for a good version in meson.build. According to repology.org, our supported host target operating systems ship these versions:
Fedora 35: 1.6.37
CentOS 8 (RHEL-8): 1.6.34
Debian 11: 1.6.37
OpenSUSE Leap 15.3: 1.6.34
Ubuntu LTS 20.04: 1.6.37
FreeBSD Ports: 1.6.37
NetBSD pkgsrc: 1.6.37
OpenBSD Ports: 1.6.37
Homebrew: 1.6.37
MSYS2 mingw: 1.6.37So it seem reasonable to require at least libpng version 1.6.34 for our builds.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1080
Message-Id: <[email protected]>
--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
@@ -1211,7 +1211,7 @@ if gtkx11.found() endif png = not_found if get_option('png').allowed() and have_system - png = dependency('libpng', required: get_option('png'), + png = dependency('libpng', version: '>=1.6.34', required: get_option('png'), method: 'pkg-config', kwargs: static_kwargs) endif vnc = not_found
Signature · 1 line
2.36.1
[PULL 12/14] audio/dbus: fix building
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
Commit c9c847481 broken dbus audio module compilation with bad 'CONFIG_GIO' usage. Furthermore, it implied extra dependency on audio module which aren't necessary.
The problem was that 'dbus_display' is not correctly automatically set on MacOS, because opengl dependency wasn't taken into account.
Message-Id: <[email protected]>
--- audio/meson.build | 2 +- meson.build | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
audio/meson.build +1 -1
@@ -28,7 +28,7 @@ endforeach if dbus_display module_ss = ss.source_set() - module_ss.add(when: [gio, pixman, opengl, 'CONFIG_GIO'], if_true: files('dbusaudio.c')) + module_ss.add(when: gio, if_true: files('dbusaudio.c')) audio_modules += {'dbus': module_ss} endif
meson.build +2 -0
@@ -1653,6 +1653,8 @@ dbus_display = get_option('dbus_display') \ error_message: '-display dbus requires --enable-modules') \ .require(gdbus_codegen.found(), error_message: '-display dbus requires gdbus-codegen') \ + .require(opengl.found(), + error_message: '-display dbus requires epoxy/egl') \ .allowed() have_virtfs = get_option('virtfs') \
Signature · 1 line
2.36.1
[PULL 08/14] tests/tcg: compile system emulation tests as freestanding
In reply to Paolo BonziniSystem emulation tests do not run in a hosted environment, since they do not link with libc. They should only use freestanding headers (float.h, limits.h, stdarg.h, stddef.h, stdbool.h, stdint.h, stdalign.h, stdnoreturn.h) and should be compiled with -ffreestanding in order to use the compiler implementation of those headers rather than the one in libc.
Some tests are using inttypes.h instead of stdint.h, so fix that.
--- tests/tcg/Makefile.target | 1 + tests/tcg/aarch64/system/pauth-3.c | 2 +- tests/tcg/aarch64/system/semiconsole.c | 2 +- tests/tcg/aarch64/system/semiheap.c | 2 +- tests/tcg/multiarch/system/memory.c | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-)
tests/tcg/Makefile.target +1 -0
@@ -111,6 +111,7 @@ else # 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. +EXTRA_CFLAGS += -ffreestanding -include $(SRC_PATH)/tests/tcg/minilib/Makefile.target -include $(SRC_PATH)/tests/tcg/multiarch/system/Makefile.softmmu-target -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.softmmu-target
tests/tcg/aarch64/system/pauth-3.c +1 -1
@@ -1,4 +1,4 @@ -#include <inttypes.h> +#include <stdint.h> #include <minilib.h> int main ()
tests/tcg/aarch64/system/semiconsole.c +1 -1
@@ -6,7 +6,7 @@* SPDX-License-Identifier: GPL-2.0-or-later */ -#include <inttypes.h> +#include <stdint.h> #include <minilib.h> #define SYS_READC 0x7
tests/tcg/aarch64/system/semiheap.c +1 -1
@@ -6,7 +6,7 @@* SPDX-License-Identifier: GPL-2.0-or-later */ -#include <inttypes.h> +#include <stdint.h> #include <stddef.h> #include <minilib.h>
tests/tcg/multiarch/system/memory.c +1 -1
@@ -12,7 +12,7 @@* - sign extension when loading */ -#include <inttypes.h> +#include <stdint.h> #include <stdbool.h> #include <minilib.h>
Signature · 1 line
2.36.1
[PULL 01/14] tests/vm: do not specify -bios option
In reply to Paolo BonziniWhen running from the build tree, the executable is able to find the BIOS on its own; when running from the source tree, a firmware blob should already be installed and there is no guarantee that the one in the source tree works with the QEMU that is being used for the installation.
Just remove the -bios option, since it is unnecessary and in fact there are other x86 VM tests that do not bother specifying it.
--- tests/vm/fedora | 1 - tests/vm/freebsd | 1 - tests/vm/netbsd | 1 - tests/vm/openbsd | 1 - 4 files changed, 4 deletions(-)
tests/vm/fedora +0 -1
@@ -79,7 +79,6 @@ class FedoraVM(basevm.BaseVM): self.exec_qemu_img("create", "-f", "qcow2", img_tmp, self.size) self.print_step("Booting installer") self.boot(img_tmp, extra_args = [ - "-bios", "pc-bios/bios-256k.bin", "-machine", "graphics=off", "-device", "VGA", "-cdrom", iso
tests/vm/freebsd +0 -1
@@ -95,7 +95,6 @@ class FreeBSDVM(basevm.BaseVM): self.print_step("Booting installer") self.boot(img_tmp, extra_args = [ - "-bios", "pc-bios/bios-256k.bin", "-machine", "graphics=off", "-device", "VGA", "-cdrom", iso
tests/vm/netbsd +0 -1
@@ -86,7 +86,6 @@ class NetBSDVM(basevm.BaseVM): self.print_step("Booting installer") self.boot(img_tmp, extra_args = [ - "-bios", "pc-bios/bios-256k.bin", "-machine", "graphics=off", "-cdrom", iso ])
tests/vm/openbsd +0 -1
@@ -82,7 +82,6 @@ class OpenBSDVM(basevm.BaseVM): self.print_step("Booting installer") self.boot(img_tmp, extra_args = [ - "-bios", "pc-bios/bios-256k.bin", "-machine", "graphics=off", "-device", "VGA", "-cdrom", iso
Signature · 1 line
2.36.1
[PULL 14/14] accel: kvm: Fix memory leak in find_stats_descriptors
In reply to Paolo BonziniFrom: Miaoqian Lin <[email protected]>
This function doesn't release descriptors in one error path, result in memory leak. Call g_free() to release it.
Message-Id: <[email protected]>
--- accel/kvm/kvm-all.c | 1 + 1 file changed, 1 insertion(+)
accel/kvm/kvm-all.c +1 -0
@@ -3891,6 +3891,7 @@ static StatsDescriptors *find_stats_descriptors(StatsTarget target, int stats_fderror_setg (errp,"KVM stats: failed to read stats header: " "expected %zu actual %zu" ,sizeof (*kvm_stats_header), ret); +g_free (descriptors);return NULL ; } size_desc =sizeof (*kvm_stats_desc) + kvm_stats_header->name_size;
Signature · 1 line
2.36.1
[PULL 10/14] build: improve -fsanitize-coverage-allowlist check
In reply to Paolo BonziniFrom: Alexander Bulekov <[email protected]>
The sancov filter check still fails when unused arguments are treated as errors. To work around that, add a SanitizerCoverage flag to the build-check.
Message-Id: <[email protected]>
--- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
meson.build +2 -1
@@ -212,7 +212,8 @@ if get_option('fuzzing') if cc.compiles('int main () { return 0; }', name: '-fsanitize-coverage-allowlist=/dev/null', - args: ['-fsanitize-coverage-allowlist=/dev/null'] ) + args: ['-fsanitize-coverage-allowlist=/dev/null', + '-fsanitize-coverage=trace-pc'] ) add_global_arguments('-fsanitize-coverage-allowlist=instrumentation-filter', native: false, language: ['c', 'cpp', 'objc']) endif
Signature · 1 line
2.36.1
Quoted 10 lines · Paolo Bonzini
The following changes since commit
2b049d2c8dc01de750410f8f1a4eac498c04c723:Merge tag 'pull-aspeed-20220622' of https://github.com/legoater/qemu into staging (2022-06-22 07:27:06 -0700)are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to
72da35fec9a9ba91a5b2cb9ee00843a94fa9413d:
Quoted 7 lines
accel: kvm: Fix memory leak in
find_stats_descriptors(2022-06-24 10:19:17 +0200)----------------------------------------------------------------
* fuzzing fixes
* fix cross compilation CFLAGS and compiler choice
* do not specify -bios option for tests/vm
* miscellaneous fixes
Build failure here. I have ubuntu 22.04,
crossbuild-essential-arm64/jammy,jammy,now 12.9ubuntu3 all [installed]
crossbuild-essential-armhf/jammy,jammy,now 12.9ubuntu3 all [installed]
crossbuild-essential-i386/jammy,jammy,now 12.9ubuntu3 all [installed]
crossbuild-essential-mips64el/jammy,jammy,now 12.9 all [installed]
crossbuild-essential-ppc64el/jammy,jammy,now 12.9ubuntu3 all [installed]
crossbuild-essential-riscv64/jammy,jammy,now 12.9ubuntu3 all [installed]
crossbuild-essential-s390x/jammy,jammy,now 12.9ubuntu3 all [installed]
which is properly detected during configure,
Cross compilers
aarch64 : aarch64-linux-gnu-gcc
alpha : $(DOCKER_SCRIPT) cc --cc alpha-linux-gnu-gcc -i
qemu/debian-alpha-cross -s /home/rth/qemu-publish/src --
arm : arm-linux-gnueabihf-gcc
i386 : i686-linux-gnu-gcc
nios2 : $(DOCKER_SCRIPT) cc --cc nios2-linux-gnu-gcc -i
qemu/debian-nios2-cross -s /home/rth/qemu-publish/src --
x86_64 : cc
...
But then the i386 cross-compiler isn't used:
$ cat tests/tcg/config-i386-softmmu.mak
# Automatically generated by configure - do not modify
TARGET_NAME=i386
BUILD_STATIC=
EXTRA_CFLAGS=-m32
CC=cc
CCAS=cc
AR=ar
AS=as
LD=ld
NM=nm
OBJCOPY=objcopy
RANLIB=ranlib
STRIP=strip
QEMU=/home/rth/qemu-publish/bld/qemu-system-i386
leading to failure:
cc -nostdlib -ggdb -O0 -isystem /home/rth/qemu-publish/src/tests/tcg/minilib -m32 -ffreestanding /home/rth/qemu-publish/src/tests/tcg/multiarch/system/hello.c -o hello -Wl,-T/home/rth/qemu-publish/src/tests/tcg/i386/system/kernel.ld -Wl,-melf_i386 -static -nostdlib boot.o printf.o -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [/home/rth/qemu-publish/src/tests/tcg/i386/Makefile.softmmu-target:32: hello] Error 1
r~
Il ven 24 giu 2022, 17:57 Richard Henderson <[email protected]> ha scritto:
Quoted 2 lines
But then the i386 cross-compiler isn't used:
Yeah, that was intentional. In theory a softmmu target is freestanding and does not need anything beyond the compiler install, so configure defaults to the native compiler, which is biarch. That however assumes that the compiler install includes the libgcc for both architectures.
Does that mean that Ubuntu installs GCC without a 32-bit libgcc.a?
Paolo
Quoted 59 lines
$ cat tests/tcg/config-i386-softmmu.mak# Automatically generated by configure - do not modify
TARGET_NAME=i386
BUILD_STATIC=
EXTRA_CFLAGS=-m32
CC=cc
CCAS=cc
AR=ar
AS=as
LD=ld
NM=nm
OBJCOPY=objcopy
RANLIB=ranlib
STRIP=strip
QEMU=/home/rth/qemu-publish/bld/qemu-system-i386
leading to failure:
cc -nostdlib -ggdb -O0 -isystem
/home/rth/qemu-publish/src/tests/tcg/minilib-m32 -ffreestanding/home/rth/qemu-publish/src/tests/tcg/multiarch/system/hello.c-o hello(quoted diff) +0
-3-Wl,-T/home/rth/qemu-publish/src/tests/tcg/i386/system/kernel.ld -Wl,-melf_i386 -static -nostdlib boot.o printf.o -lgcc
/usr/bin/ld: skipping incompatible/usr/lib/gcc/x86_64-linux-gnu/11/libgcc.awhen
searching for -lgcc
/usr/bin/ld: cannot find -lgcc: No such file or directorycollect2: error: ld returned 1 exit status
make[1]: *** [
/home/rth/qemu-publish/src/tests/tcg/i386/Makefile.softmmu-target:32:
hello]
Error 1r~
Quoted 11 lines · Paolo Bonzini
Il ven 24 giu 2022, 17:57 Richard Henderson <[email protected]> ha scritto:
Quoted 2 lines
But then the i386 cross-compiler isn't used:
Yeah, that was intentional. In theory a softmmu target is freestanding and does not need anything beyond the compiler install, so configure defaults to the native compiler, which is biarch. That however assumes that the compiler install includes the libgcc for both architectures.
Does that mean that Ubuntu installs GCC without a 32-bit libgcc.a?
I think they package it in a separate package, eg lib32gcc-9-dev (adjust package name to suit gcc version).
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Paolo Bonzini
Il ven 24 giu 2022, 17:57 Richard Henderson <[email protected]> ha scritto:
Quoted 2 lines
But then the i386 cross-compiler isn't used:
Quoted 6 lines
Quoted 3 lines
Yeah, that was intentional. In theory a softmmu target is freestanding and does not need anything beyond the compiler install, so configure defaults to the native compiler, which is biarch. That however assumes that the compiler install includes the libgcc for both architectures.
Does that mean that Ubuntu installs GCC without a 32-bit libgcc.a?
I think they package it in a separate package, eg lib32gcc-9-dev (adjust package name to suit gcc version).
It's there, as Peter says, but it's not installed with the build-essential meta-package, and the crossbuild-essential-i386 package installs a different libgcc.
r~
Il ven 1 lug 2022, 02:26 Richard Henderson <[email protected]> ha scritto:
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
Does that mean that Ubuntu installs GCC without a 32-bit libgcc.a?
I think they package it in a separate package, eg lib32gcc-9-dev (adjust package name to suit gcc version).
It's there, as Peter says, but it's not installed with the build-essential meta-package,
and the crossbuild-essential-i386 package installs a different libgcc.
Ok I will try using ld -r to detect the presence of libgcc.
Paolo
Quoted 4 lines
r~