From nobody Tue Dec 16 08:31:25 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597082825; cv=none; d=zohomail.com; s=zohoarc; b=KbRN9Zm6qTzj8lkVVj14UK1cLf3xkWFRXiI6R/jipEvdCfFHWnvJCkNJcYekgljskLHsuDT38gzfLvhK4I3EXFbXqmmMzn+ZUuxqfn4LklTgAliJvAuTmNH/1cgwiNgr6WoVhx5EphObImbrZueXd8J0DGsf/oR2nqvL/gGsSAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597082825; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uwOpWu1aIgBDoVYU9A9YnjLGgBlisAxmRrWn0a5gX1o=; b=jSjuPyXc/mfMuOCqrnOJQuiqU7l9hT35l31aZaOdASAfbtDv/9HL/CXMtHECdGdbC/AFt7YKVK53zaOABc12rW3487l2x3DdE3CpsgwwbjCP6dOimU2Frps/gkOca7D1WSZ0eJnbhnt0Y1zoc/4WI5PbTOa+fJJSsE0ps1SAKn8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597082825364496.37521775218306; Mon, 10 Aug 2020 11:07:05 -0700 (PDT) Received: from localhost ([::1]:49716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k5CCN-00083r-Tb for importer@patchew.org; Mon, 10 Aug 2020 14:07:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k5BLz-0003W0-8t for qemu-devel@nongnu.org; Mon, 10 Aug 2020 13:12:55 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21036 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k5BLu-0003Mz-Oh for qemu-devel@nongnu.org; Mon, 10 Aug 2020 13:12:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-294-jr5XfcXJMhKQ1luXd-j1Qg-1; Mon, 10 Aug 2020 13:12:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E158800472 for ; Mon, 10 Aug 2020 17:12:46 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C6A75F1E9; Mon, 10 Aug 2020 17:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597079570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uwOpWu1aIgBDoVYU9A9YnjLGgBlisAxmRrWn0a5gX1o=; b=ccvRutTM21DQ9h6oOjAxdDzbVTIrebrld8FgqZ7gsV4UGeYLNYjrV4C0APm+L1g0JUdyA8 guJ+ABNnIPvbtvRAWdOZUJqTUeAL49AmYlAiF6LohyQSr0qk/q/BPNn1taHO6vOXX21kxh aneS6Wa5epzJ5w3aE75YUwEn7OaSB+Q= X-MC-Unique: jr5XfcXJMhKQ1luXd-j1Qg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 131/147] meson: link emulators without Makefile.target Date: Mon, 10 Aug 2020 19:08:49 +0200 Message-Id: <1597079345-42801-132-git-send-email-pbonzini@redhat.com> In-Reply-To: <1597079345-42801-1-git-send-email-pbonzini@redhat.com> References: <1597079345-42801-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=pbonzini@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/10 11:00:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- .gitlab-ci.yml | 6 +- Makefile | 34 +------ Makefile.objs | 32 ------- Makefile.target | 153 +-------------------------= ---- configure | 24 ++--- docs/devel/blkverify.txt | 4 +- docs/devel/testing.rst | 4 +- docs/interop/live-block-operations.rst | 4 +- meson.build | 73 +++++++++++++- os-posix.c | 2 +- plugins/meson.build | 10 +- rules.mak | 1 - scripts/device-crash-test | 2 +- scripts/oss-fuzz/build.sh | 20 ++-- softmmu/Makefile.objs | 2 - tests/Makefile.include | 4 +- tests/acceptance/avocado_qemu/__init__.py | 3 +- tests/data/acpi/rebuild-expected-aml.sh | 2 +- tests/multiboot/run_test.sh | 2 +- tests/qemu-iotests/check | 6 +- tests/qtest/fuzz/Makefile.include | 39 -------- tests/qtest/fuzz/i440fx_fuzz.c | 4 +- tests/qtest/fuzz/meson.build | 35 +++++++ tests/qtest/fuzz/qtest_wrappers.c | 2 +- tests/qtest/fuzz/virtio_net_fuzz.c | 3 +- tests/qtest/fuzz/virtio_scsi_fuzz.c | 8 +- tests/qtest/libqos/qgraph.h | 2 +- tests/qtest/meson.build | 2 +- tests/qtest/rtas-test.c | 2 +- tests/tcg/configure.sh | 4 +- 30 files changed, 168 insertions(+), 321 deletions(-) delete mode 100644 softmmu/Makefile.objs delete mode 100644 tests/qtest/fuzz/Makefile.include create mode 100644 tests/qtest/fuzz/meson.build diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9820066..b7967b9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -265,9 +265,9 @@ build-tci: - make run-tcg-tests-x86_64-softmmu - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest= /pxe-test - for tg in $TARGETS ; do - export QTEST_QEMU_BINARY=3D"${tg}-softmmu/qemu-system-${tg}" ; + export QTEST_QEMU_BINARY=3D"./qemu-system-${tg}" ; ./tests/qtest/boot-serial-test || exit 1 ; ./tests/qtest/cdrom-test || exit 1 ; done - - QTEST_QEMU_BINARY=3D"x86_64-softmmu/qemu-system-x86_64" ./tests/qtes= t/pxe-test - - QTEST_QEMU_BINARY=3D"s390x-softmmu/qemu-system-s390x" ./tests/qtest/= pxe-test -m slow + - QTEST_QEMU_BINARY=3D"./qemu-system-x86_64" ./tests/qtest/pxe-test + - QTEST_QEMU_BINARY=3D"./qemu-system-s390x" ./tests/qtest/pxe-test -m = slow diff --git a/Makefile b/Makefile index e3ccea0..ebda912 100644 --- a/Makefile +++ b/Makefile @@ -105,9 +105,6 @@ include $(SRC_PATH)/rules.mak # lor is defined in rules.mak CONFIG_BLOCK :=3D $(call lor,$(CONFIG_SOFTMMU),$(CONFIG_TOOLS)) =20 -generated-files-y +=3D target/s390x/gen-features.h -target/s390x/gen-features.h: Makefile.ninja - generated-files-y +=3D .git-submodule-status =20 # Don't try to regenerate Makefile or configure @@ -171,29 +168,6 @@ config-host.h-timestamp: config-host.mak =20 TARGET_DIRS_RULES :=3D $(foreach t, all fuzz clean install, $(addsuffix /$= (t), $(TARGET_DIRS))) =20 -SOFTMMU_ALL_RULES=3D$(filter %-softmmu/all, $(TARGET_DIRS_RULES)) -$(SOFTMMU_ALL_RULES): $(authz-obj-y) -$(SOFTMMU_ALL_RULES): $(block-obj-y) -$(SOFTMMU_ALL_RULES): $(chardev-obj-y) -$(SOFTMMU_ALL_RULES): $(crypto-obj-y) -$(SOFTMMU_ALL_RULES): $(io-obj-y) -$(SOFTMMU_ALL_RULES): $(qom-obj-y) -$(SOFTMMU_ALL_RULES): config-all-devices.mak - -SOFTMMU_FUZZ_RULES=3D$(filter %-softmmu/fuzz, $(TARGET_DIRS_RULES)) -$(SOFTMMU_FUZZ_RULES): $(authz-obj-y) -$(SOFTMMU_FUZZ_RULES): $(block-obj-y) -$(SOFTMMU_FUZZ_RULES): $(chardev-obj-y) -$(SOFTMMU_FUZZ_RULES): $(crypto-obj-y) -$(SOFTMMU_FUZZ_RULES): $(io-obj-y) -$(SOFTMMU_FUZZ_RULES): config-all-devices.mak -$(SOFTMMU_FUZZ_RULES): $(edk2-decompressed) - -# meson: this is sub-optimal but going away after conversion -TARGET_DEPS =3D $(patsubst %,%-config-target.h, $(TARGET_DIRS)) -TARGET_DEPS +=3D $(patsubst %,%-config-devices.h, $(filter %-softmmu,$(TAR= GET_DIRS))) -TARGET_DEPS +=3D $(patsubst %,libqemu-%.fa, $(TARGET_DIRS)) - .PHONY: $(TARGET_DIRS_RULES) # The $(TARGET_DIRS_RULES) are of the form SUBDIR/GOAL, so that # $(dir $@) yields the sub-directory, and $(notdir $@) yields the sub-goal @@ -236,11 +210,7 @@ slirp/all: .git-submodule-status CC=3D"$(CC)" AR=3D"$(AR)" LD=3D"$(LD)" RANLIB=3D"$(RANLIB)" \ CFLAGS=3D"$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS=3D"$(QEMU_LDFLAGS)") =20 -$(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \ - $(qom-obj-y) block.syms qemu.syms - -$(filter %/fuzz, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \ - $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY)) +$(filter %/all, $(TARGET_DIRS_RULES)): =20 ROM_DIRS =3D $(addprefix pc-bios/, $(ROMS)) ROM_DIRS_RULES=3D$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS))) @@ -262,8 +232,6 @@ Makefile: $(version-obj-y) =20 ###################################################################### =20 -COMMON_LDADDS =3D libqemuutil.a - clean: recurse-clean # avoid old build problems by removing potentially incorrect old files rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h ge= n-op-arm.h diff --git a/Makefile.objs b/Makefile.objs index 83622c5..5295c3a 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -34,37 +34,5 @@ io-obj-y =3D io/libio.fa endif # CONFIG_SOFTMMU or CONFIG_TOOLS =20 ###################################################################### -# Target independent part of system emulation. The long term path is to -# suppress *all* target specific code in case of system emulation, i.e. a -# single QEMU executable should support all CPUs and machines. - -ifeq ($(CONFIG_SOFTMMU),y) -common-obj-y =3D - -common-obj-$(CONFIG_AUDIO_ALSA) +=3D audio-alsa$(DSOSUF) -common-obj-$(CONFIG_AUDIO_OSS) +=3D audio-oss$(DSOSUF) -common-obj-$(CONFIG_AUDIO_PA) +=3D audio-pa$(DSOSUF) -common-obj-$(CONFIG_AUDIO_SDL) +=3D audio-sdl$(DSOSUF) - -common-obj-$(if $(CONFIG_CURSES),m) +=3D ui-curses$(DSOSUF) -common-obj-$(if $(CONFIG_GTK),m) +=3D ui-gtk$(DSOSUF) -common-obj-$(if $(CONFIG_SDL),m) +=3D ui-sdl$(DSOSUF) -common-obj-$(if $(CONFIG_SPICE),m) +=3D ui-spice-app$(DSOSUF) - -common-obj-$(if $(CONFIG_CURL),m) +=3D block-curl$(DSOSUF) -common-obj-$(if $(CONFIG_GLUSTERFS),m) +=3D block-gluster$(DSOSUF) -common-obj-$(if $(CONFIG_LIBISCSI),m) +=3D block-iscsi$(DSOSUF) -common-obj-$(if $(CONFIG_LIBNFS),m) +=3D block-nfs$(DSOSUF) -common-obj-$(if $(CONFIG_LIBSSH),m) +=3D block-ssh$(DSOSUF) -common-obj-$(if $(CONFIG_RBD),m) +=3D block-rbd$(DSOSUF) - -common-obj-$(if $(CONFIG_LZFSE),m) +=3D block-dmg-lzfse$(DSOSUF) -common-obj-$(if $(and $(CONFIG_BZIP2),$(CONFIG_DMG)),m) +=3D block-dmg-bz2= $(DSOSUF) - -common-obj-y +=3D libqmp.fa - -endif # CONFIG_SOFTMMU - -###################################################################### # Resource file for Windows executables version-obj-$(CONFIG_WIN32) +=3D $(BUILD_DIR)/version.o diff --git a/Makefile.target b/Makefile.target index 2b7280b..8ee4c78 100644 --- a/Makefile.target +++ b/Makefile.target @@ -6,43 +6,16 @@ include ../config-host.mak include config-target.mak include $(SRC_PATH)/rules.mak =20 -FULL_TARGET_NAME=3D$(TARGET_NAME)-$(if $(CONFIG_SOFTMMU),softmmu,linux-use= r) - -ifdef CONFIG_SOFTMMU -include ../$(FULL_TARGET_NAME)-config-devices.mak -endif - $(call set-vpath, $(SRC_PATH):$(BUILD_DIR)) -ifdef CONFIG_LINUX -QEMU_CFLAGS +=3D -isystem ../linux-headers -endif -QEMU_CFLAGS +=3D -iquote .. -iquote $(SRC_PATH)/target/$(TARGET_BASE_ARCH)= -DNEED_CPU_H - -QEMU_CFLAGS+=3D-iquote $(SRC_PATH)/include - -QEMU_CFLAGS +=3D -DCONFIG_TARGET=3D\"../$(FULL_TARGET_NAME)-config-target.= h\" -QEMU_CFLAGS +=3D -DCONFIG_DEVICES=3D\"../$(FULL_TARGET_NAME)-config-device= s.h\" =20 ifdef CONFIG_USER_ONLY # user emulator name QEMU_PROG=3Dqemu-$(TARGET_NAME) -QEMU_PROG_BUILD =3D $(QEMU_PROG) else # system emulator name QEMU_PROG=3Dqemu-system-$(TARGET_NAME)$(EXESUF) -ifneq (,$(findstring -mwindows,$(SDL_LIBS))) -# Terminate program name with a 'w' because the linker builds a windows ex= ecutable. -QEMU_PROGW=3Dqemu-system-$(TARGET_NAME)w$(EXESUF) -$(QEMU_PROG): $(QEMU_PROGW) - $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_= PROG),"GEN","$(TARGET_DIR)$(QEMU_PROG)") -QEMU_PROG_BUILD =3D $(QEMU_PROGW) -else -QEMU_PROG_BUILD =3D $(QEMU_PROG) -endif endif =20 -LIBQEMU =3D ../libqemu-$(FULL_TARGET_NAME).fa -PROGS=3D$(QEMU_PROG) $(QEMU_PROGW) STPFILES=3D =20 ifdef CONFIG_TRACE_SYSTEMTAP @@ -98,109 +71,10 @@ stap: endif .PHONY: stap =20 -all: $(PROGS) stap - -# Dummy command so that make thinks it has done something - @true - -obj-y +=3D $(LIBQEMU) - -obj-y +=3D trace/ - -######################################################### -LIBS :=3D $(libs_cpu) $(LIBS) - -######################################################### -# Linux user emulator target - -ifdef CONFIG_LINUX_USER - -QEMU_CFLAGS+=3D-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \ - -I$(SRC_PATH)/linux-user/host/$(ARCH) \ - -I$(SRC_PATH)/linux-user \ - -Ilinux-user/$(TARGET_ABI_DIR) - -endif #CONFIG_LINUX_USER - -######################################################### -# BSD user emulator target - -ifdef CONFIG_BSD_USER - -QEMU_CFLAGS+=3D-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_= DIR) \ - -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR) - -endif #CONFIG_BSD_USER - -######################################################### -# System emulator target -ifdef CONFIG_SOFTMMU -obj-y +=3D softmmu/ -obj-y +=3D gdbstub.o -LIBS :=3D $(libs_softmmu) $(LIBS) - -# Temporary until emulators are linked by Meson -LIBS :=3D $(LIBS) @../block.syms @../qemu.syms -ifneq ($(CONFIG_MODULES),y) -LIBS :=3D $(LIBS) $(ALSA_LIBS) $(OSS_LIBS) $(PULSE_LIBS) $(SDL_LIBS) -LIBS :=3D $(LIBS) $(GTK_LIBS) $(VTE_LIBS) $(X11_LIBS) $(CURSES_LIBS) $(ICO= NV_LIBS) $(GIO_LIBS) -endif -LIBS :=3D $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) $(OPENGL_LIBS) = $(SECCOMP_LIBS) -LIBS :=3D $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS) -LIBS :=3D $(LIBS) $(VDE_LIBS) $(SLIRP_LIBS) -LIBS :=3D $(LIBS) $(LIBUSB_LIBS) $(SMARTCARD_LIBS) $(USB_REDIR_LIBS) -LIBS :=3D $(LIBS) $(VIRGL_LIBS) $(CURSES_LIBS) - -ifeq ($(CONFIG_PLUGIN),y) -ifdef CONFIG_HAS_LD_DYNAMIC_LIST -LIBS +=3D -Wl,--dynamic-list=3D$(BUILD_DIR)/qemu-plugins-ld.symbols -else -ifdef CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST -LIBS +=3D -Wl,-exported_symbols_list,$(BUILD_DIR)/qemu-plugins-ld64.symbols -endif -endif -endif - -generated-files-y +=3D hmp-commands.h hmp-commands-info.h - -endif # CONFIG_SOFTMMU - -dummy :=3D $(call unnest-vars,,obj-y) -all-obj-y :=3D $(obj-y) - -include $(SRC_PATH)/Makefile.objs -dummy :=3D $(call fix-paths,../,, \ - authz-obj-y \ - block-obj-y \ - chardev-obj-y \ - crypto-obj-y \ - io-obj-y \ - qom-obj-y) -dummy :=3D $(call unnest-vars,..,common-obj-y) - -all-obj-y +=3D $(common-obj-y) -all-obj-y +=3D $(qom-obj-y) -all-obj-$(CONFIG_SOFTMMU) +=3D $(authz-obj-y) -all-obj-$(CONFIG_SOFTMMU) +=3D $(block-obj-y) $(chardev-obj-y) -all-obj-$(CONFIG_SOFTMMU) +=3D $(crypto-obj-y) -all-obj-$(CONFIG_SOFTMMU) +=3D $(io-obj-y) - -ifdef CONFIG_SOFTMMU -$(QEMU_PROG_BUILD): ../$(FULL_TARGET_NAME)-config-devices.mak -endif - -COMMON_LDADDS =3D ../libqemuutil.a - -# build either PROG or PROGW -$(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS) $(softmmu-main-y) - $(call LINK, $(filter-out %.mak, $^)) -ifdef CONFIG_DARWIN - $(call quiet-command,Rez -append $(SRC_PATH)/pc-bios/qemu.rsrc -o $@,"REZ= ","$(TARGET_DIR)$@") - $(call quiet-command,SetFile -a C $@,"SETFILE","$(TARGET_DIR)$@") -endif +all: stap =20 -clean: clean-target - rm -f *.a *~ $(PROGS) +clean: + rm -f *.a *~ rm -f $(shell find . -name '*.[od]') rm -f hmp-commands.h gdbstub-xml.c rm -f trace/generated-helpers.c trace/generated-helpers.c-timestamp @@ -208,26 +82,7 @@ ifdef CONFIG_TRACE_SYSTEMTAP rm -f *.stp endif =20 -ifdef CONFIG_FUZZ -include $(SRC_PATH)/tests/qtest/fuzz/Makefile.include -include $(SRC_PATH)/tests/qtest/Makefile.include - -fuzz: fuzz-vars -fuzz-vars: QEMU_CFLAGS :=3D $(FUZZ_CFLAGS) $(QEMU_CFLAGS) -fuzz-vars: QEMU_LDFLAGS :=3D $(FUZZ_LDFLAGS) $(QEMU_LDFLAGS) -fuzz-vars: $(QEMU_PROG_FUZZ) -dummy :=3D $(call unnest-vars,, fuzz-obj-y) - - -$(QEMU_PROG_FUZZ): config-devices.mak $(all-obj-y) $(COMMON_LDADDS) $(fuzz= -obj-y) - $(call LINK, $(filter-out %.mak, $^)) - -endif - install: all -ifneq ($(PROGS),) - $(call install-prog,$(PROGS),$(DESTDIR)$(bindir)) -endif ifdef CONFIG_TRACE_SYSTEMTAP $(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/../systemtap/tapset" $(INSTALL_DATA) $(QEMU_PROG).stp-installed "$(DESTDIR)$(qemu_datadir)/../= systemtap/tapset/$(QEMU_PROG).stp" @@ -235,4 +90,4 @@ ifdef CONFIG_TRACE_SYSTEMTAP $(INSTALL_DATA) $(QEMU_PROG)-log.stp "$(DESTDIR)$(qemu_datadir)/../system= tap/tapset/$(QEMU_PROG)-log.stp" endif =20 -Makefile: $(generated-files-y) +.PHONY: all clean install diff --git a/configure b/configure index a912055..23e93aa 100755 --- a/configure +++ b/configure @@ -316,7 +316,6 @@ audio_drv_list=3D"" block_drv_rw_whitelist=3D"" block_drv_ro_whitelist=3D"" host_cc=3D"cc" -libs_cpu=3D"" libs_softmmu=3D"" libs_tools=3D"" audio_win_int=3D"" @@ -5417,7 +5416,6 @@ case "$capstone" in else LIBCAPSTONE=3Dlibcapstone.a fi - libs_cpu=3D"-L$PWD/capstone -lcapstone $libs_cpu" capstone_libs=3D"-L$PWD/capstone -lcapstone" capstone_cflags=3D"-I${source_path}/capstone/include" ;; @@ -5426,7 +5424,6 @@ case "$capstone" in capstone_libs=3D"$($pkg_config --libs capstone)" capstone_cflags=3D"$($pkg_config --cflags capstone)" QEMU_CFLAGS=3D"$QEMU_CFLAGS $($pkg_config --cflags capstone)" - libs_cpu=3D"$($pkg_config --libs capstone) $libs_cpu" ;; =20 no) @@ -6344,7 +6341,10 @@ fi if test "$fuzzing" =3D "yes" ; then write_c_fuzzer_skeleton if compile_prog "$CPU_CFLAGS -Werror -fsanitize=3Dfuzzer" ""; then - have_fuzzer=3Dyes + have_fuzzer=3Dyes + else + error_exit "Your compiler doesn't support -fsanitize=3Dfuzzer" + exit 1 fi fi =20 @@ -6844,7 +6844,6 @@ echo "qemu_helperdir=3D$libexecdir" >> $config_host_m= ak echo "qemu_localedir=3D$qemu_localedir" >> $config_host_mak echo "qemu_icondir=3D$qemu_icondir" >> $config_host_mak echo "qemu_desktopdir=3D$qemu_desktopdir" >> $config_host_mak -echo "libs_cpu=3D$libs_cpu" >> $config_host_mak echo "libs_softmmu=3D$libs_softmmu" >> $config_host_mak echo "GIT=3D$git" >> $config_host_mak echo "GIT_SUBMODULES=3D$git_submodules" >> $config_host_mak @@ -7709,14 +7708,7 @@ if test "$have_mlockall" =3D "yes" ; then echo "HAVE_MLOCKALL=3Dy" >> $config_host_mak fi if test "$fuzzing" =3D "yes" ; then - if test "$have_fuzzer" =3D "yes"; then - FUZZ_LDFLAGS=3D" -fsanitize=3Dfuzzer" - FUZZ_CFLAGS=3D" -fsanitize=3Dfuzzer" - QEMU_CFLAGS=3D"$QEMU_CFLAGS -fsanitize=3Dfuzzer-no-link" - else - error_exit "Your compiler doesn't support -fsanitize=3Dfuzzer" - exit 1 - fi + QEMU_CFLAGS=3D"$QEMU_CFLAGS -fsanitize=3Dfuzzer-no-link" fi =20 if test "$plugins" =3D "yes" ; then @@ -7832,8 +7824,6 @@ if test "$libudev" !=3D "no"; then fi if test "$fuzzing" !=3D "no"; then echo "CONFIG_FUZZ=3Dy" >> $config_host_mak - echo "FUZZ_CFLAGS=3D$FUZZ_CFLAGS" >> $config_host_mak - echo "FUZZ_LDFLAGS=3D$FUZZ_LDFLAGS" >> $config_host_mak fi =20 if test "$edk2_blobs" =3D "yes" ; then @@ -8303,8 +8293,8 @@ if test "$TARGET_ARCH" =3D "s390x" && test "$target_s= oftmmu" =3D "yes" && \ fi fi =20 -echo "QEMU_LDFLAGS+=3D$ldflags" >> $config_target_mak -echo "QEMU_CFLAGS+=3D$cflags" >> $config_target_mak +echo "QEMU_LDFLAGS=3D$ldflags" >> $config_target_mak +echo "QEMU_CFLAGS=3D$cflags" >> $config_target_mak =20 done # for target in $targets =20 diff --git a/docs/devel/blkverify.txt b/docs/devel/blkverify.txt index d556dc4..aca826c 100644 --- a/docs/devel/blkverify.txt +++ b/docs/devel/blkverify.txt @@ -62,8 +62,8 @@ A more realistic scenario is verifying the installation o= f a guest OS: =20 $ ./qemu-img create raw.img 16G $ ./qemu-img create -f qcow2 test.qcow2 16G - $ x86_64-softmmu/qemu-system-x86_64 -cdrom debian.iso \ - -drive file=3Dblkverify:raw.img:te= st.qcow2 + $ ./qemu-system-x86_64 -cdrom debian.iso \ + -drive file=3Dblkverify:raw.img:test.qcow2 =20 If the installation is aborted when blkverify detects corruption, use qemu= -io to explore the contents of the disk image at the sector in question. diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index a426469..196e3bc 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -819,7 +819,7 @@ the following approaches: 1) Set ``qemu_bin``, and use the given binary =20 2) Do not set ``qemu_bin``, and use a QEMU binary named like - "${arch}-softmmu/qemu-system-${arch}", either in the current + "qemu-system-${arch}", either in the current working directory, or in the current source tree. =20 The resulting ``qemu_bin`` value will be preserved in the @@ -886,7 +886,7 @@ like the following: =20 .. code:: =20 - PARAMS (key=3Dqemu_bin, path=3D*, default=3Dx86_64-softmmu/qemu-system-x= 86_64) =3D> 'x86_64-softmmu/qemu-system-x86_64 + PARAMS (key=3Dqemu_bin, path=3D*, default=3D./qemu-system-x86_64) =3D> '= ./qemu-system-x86_64 =20 arch ~~~~ diff --git a/docs/interop/live-block-operations.rst b/docs/interop/live-blo= ck-operations.rst index 48afdc7..e13f5a2 100644 --- a/docs/interop/live-block-operations.rst +++ b/docs/interop/live-block-operations.rst @@ -129,7 +129,7 @@ To show some example invocations of command-line, we wi= ll use the following invocation of QEMU, with a QMP server running over UNIX socket:: =20 - $ ./x86_64-softmmu/qemu-system-x86_64 -display none -no-user-config \ + $ ./qemu-system-x86_64 -display none -no-user-config \ -M q35 -nodefaults -m 512 \ -blockdev node-name=3Dnode-A,driver=3Dqcow2,file.driver=3Dfile,fil= e.node-name=3Dfile,file.filename=3D./a.qcow2 \ -device virtio-blk,drive=3Dnode-A,id=3Dvirtio0 \ @@ -694,7 +694,7 @@ instance, with the following invocation. (As noted ear= lier, for simplicity's sake, the destination QEMU is started on the same host, but it could be located elsewhere):: =20 - $ ./x86_64-softmmu/qemu-system-x86_64 -display none -no-user-config \ + $ ./qemu-system-x86_64 -display none -no-user-config \ -M q35 -nodefaults -m 512 \ -blockdev node-name=3Dnode-TargetDisk,driver=3Dqcow2,file.driver= =3Dfile,file.node-name=3Dfile,file.filename=3D./target-disk.qcow2 \ -device virtio-blk,drive=3Dnode-TargetDisk,id=3Dvirtio0 \ diff --git a/meson.build b/meson.build index 420e60b..797e69d 100644 --- a/meson.build +++ b/meson.build @@ -203,10 +203,12 @@ brlapi =3D not_found if 'CONFIG_BRLAPI' in config_host brlapi =3D declare_dependency(link_args: config_host['BRLAPI_LIBS'].spli= t()) endif +sdlwindows =3D false sdl =3D not_found if 'CONFIG_SDL' in config_host sdl =3D declare_dependency(compile_args: config_host['SDL_CFLAGS'].split= (), link_args: config_host['SDL_LIBS'].split()) + sdlwindows =3D config_host['SDL_LIBS'].contains('-mwindows') endif rbd =3D not_found if 'CONFIG_RBD' in config_host @@ -517,6 +519,7 @@ user_ss =3D ss.source_set() bsd_user_ss =3D ss.source_set() linux_user_ss =3D ss.source_set() specific_ss =3D ss.source_set() +specific_fuzz_ss =3D ss.source_set() =20 modules =3D {} hw_arch =3D {} @@ -731,6 +734,7 @@ specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true:= linux_user_ss) =20 # needed for fuzzing binaries subdir('tests/qtest/libqos') +subdir('tests/qtest/fuzz') =20 mods =3D [] block_mods =3D [] @@ -785,6 +789,9 @@ libqmp =3D static_library('qmp', qmp_ss.sources(), =20 qmp =3D declare_dependency(link_whole: [libqmp]) =20 +softmmu_ss.add(authz, block, chardev, crypto, io, qmp) +common_ss.add(qom, qemuutil) + foreach m : mods shared_module(m['dir'] + '-' + m['name'], name_prefix: '', @@ -793,7 +800,7 @@ foreach m : mods install_dir: config_host['qemu_moddir']) endforeach =20 -common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: softmmu_ss) +common_ss.add_all(when: 'CONFIG_SOFTMMU', if_true: [softmmu_ss]) common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss) =20 common_all =3D common_ss.apply(config_all, strict: false) @@ -805,11 +812,17 @@ common_all =3D static_library('common', =20 feature_to_c =3D find_program('scripts/feature_to_c.sh') =20 +emulators =3D [] foreach target : target_dirs config_target =3D config_target_mak[target] target_name =3D config_target['TARGET_NAME'] arch =3D config_target['TARGET_BASE_ARCH'] arch_srcs =3D [] + arch_deps =3D [] + c_args =3D config_target['QEMU_CFLAGS'].split() + ['-DNEED_CPU_H', + '-DCONFIG_TARGET=3D"@0@-config-target.h"'.format(target), + '-DCONFIG_DEVICES=3D"@0@-config-devices.h"'.format(targe= t)] + link_args =3D config_target['QEMU_LDFLAGS'].split() =20 target_inc =3D [include_directories('target' / config_target['TARGET_BAS= E_ARCH'])] if host_machine.system() =3D=3D 'linux' @@ -820,12 +833,15 @@ foreach target : target_dirs target_type=3D'system' t =3D target_softmmu_arch[arch].apply(config_target, strict: false) arch_srcs +=3D t.sources() + arch_deps +=3D t.dependencies() =20 hw_dir =3D target_name =3D=3D 'sparc64' ? 'sparc64' : arch hw =3D hw_arch[hw_dir].apply(config_target, strict: false) arch_srcs +=3D hw.sources() + arch_deps +=3D hw.dependencies() =20 arch_srcs +=3D config_devices_h[target] + link_args +=3D ['@block.syms', '@qemu.syms'] else abi =3D config_target['TARGET_ABI_DIR'] target_type=3D'user' @@ -862,9 +878,11 @@ foreach target : target_dirs =20 t =3D target_arch[arch].apply(config_target, strict: false) arch_srcs +=3D t.sources() + arch_deps +=3D t.dependencies() =20 target_common =3D common_ss.apply(config_target, strict: false) objects =3D common_all.extract_objects(target_common.sources()) + deps =3D target_common.dependencies() =20 # TODO: Change to generator once obj-y goes away config_target_h =3D custom_target(target + '-config-target.h', @@ -875,15 +893,60 @@ foreach target : target_dirs =20 target_specific =3D specific_ss.apply(config_target, strict: false) arch_srcs +=3D target_specific.sources() + arch_deps +=3D target_specific.dependencies() =20 - static_library('qemu-' + target, + lib =3D static_library('qemu-' + target, sources: arch_srcs + [config_target_h] + genh, objects: objects, include_directories: target_inc, - c_args: ['-DNEED_CPU_H', - '-DCONFIG_TARGET=3D"@0@-config-target.h"'.format= (target), - '-DCONFIG_DEVICES=3D"@0@-config-devices.h"'.form= at(target)], + c_args: c_args, + build_by_default: false, name_suffix: 'fa') + + if target.endswith('-softmmu') + execs =3D [{ + 'name': 'qemu-system-' + target_name, + 'gui': false, + 'sources': files('softmmu/main.c'), + 'dependencies': [] + }] + if sdlwindows + execs +=3D [{ + 'name': 'qemu-system-' + target_name + 'w', + 'gui': true, + 'sources': files('softmmu/main.c'), + 'dependencies': [] + }] + endif + if config_host.has_key('CONFIG_FUZZ') + specific_fuzz =3D specific_fuzz_ss.apply(config_target, strict: fals= e) + execs +=3D [{ + 'name': 'qemu-fuzz-' + target_name, + 'gui': false, + 'sources': specific_fuzz.sources(), + 'dependencies': specific_fuzz.dependencies(), + 'link_depends': [files('tests/qtest/fuzz/fork_fuzz.ld')], + }] + endif + else + execs =3D [{ + 'name': 'qemu-' + target_name, + 'gui': false, + 'sources': [], + 'dependencies': [] + }] + endif + foreach exe: execs + emulators +=3D executable(exe['name'], exe['sources'], + install: true, + c_args: c_args, + dependencies: arch_deps + deps + exe['dependencies'], + objects: lib.extract_all_objects(recursive: true), + link_language: 'cpp', + link_depends: [block_syms, qemu_syms] + exe.get('link_depen= ds', []), + link_args: link_args, + gui_app: exe['gui']) + endforeach endforeach =20 # Other build targets diff --git a/os-posix.c b/os-posix.c index 3572db3..8334193 100644 --- a/os-posix.c +++ b/os-posix.c @@ -96,7 +96,7 @@ char *os_find_datadir(void) exec_dir =3D qemu_get_exec_dir(); g_return_val_if_fail(exec_dir !=3D NULL, NULL); =20 - dir =3D g_build_filename(exec_dir, "..", "pc-bios", NULL); + dir =3D g_build_filename(exec_dir, "pc-bios", NULL); if (g_file_test(dir, G_FILE_TEST_IS_DIR)) { return g_steal_pointer(&dir); } diff --git a/plugins/meson.build b/plugins/meson.build index 9608e52..e777230 100644 --- a/plugins/meson.build +++ b/plugins/meson.build @@ -1,5 +1,13 @@ +if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host + plugin_ldflags =3D ['-Wl,--dynamic-list=3D' + (meson.build_root() / 'qem= u-plugins-ld.symbols')] +elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host + plugin_ldflags =3D ['-Wl,-exported_symbols_list,' + (meson.build_root() = / 'qemu-plugins-ld64.symbols')] +else + plugin_ldflags =3D [] +endif + specific_ss.add(when: 'CONFIG_PLUGIN', if_true: [files( 'loader.c', 'core.c', 'api.c', -)]) +), declare_dependency(link_args: plugin_ldflags)]) diff --git a/rules.mak b/rules.mak index 8285fe5..6488dc3 100644 --- a/rules.mak +++ b/rules.mak @@ -21,7 +21,6 @@ MAKEFLAGS +=3D -rR %.cpp: %.m: %.mak: -clean-target: =20 # Flags for dependency generation QEMU_DGFLAGS +=3D -MMD -MP -MT $@ -MF $(@D)/$(*F).d diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 305d042..866baf7 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -383,7 +383,7 @@ def binariesToTest(args, testcase): if args.qemu: r =3D args.qemu else: - r =3D glob.glob('./*-softmmu/qemu-system-*') + r =3D glob.glob('./qemu-system-*') return r =20 =20 diff --git a/scripts/oss-fuzz/build.sh b/scripts/oss-fuzz/build.sh index 52430cb..f0b7442 100755 --- a/scripts/oss-fuzz/build.sh +++ b/scripts/oss-fuzz/build.sh @@ -64,24 +64,26 @@ mkdir -p "$DEST_DIR/lib/" # Copy the shared libraries = here =20 # Build once to get the list of dynamic lib paths, and copy them over ../configure --disable-werror --cc=3D"$CC" --cxx=3D"$CXX" --enable-fuzzing= \ + --prefix=3D"$DEST_DIR" --bindir=3D"$DEST_DIR" --datadir=3D"$DEST_DIR/d= ata/" \ --extra-cflags=3D"$EXTRA_CFLAGS" --target-list=3D"i386-softmmu" =20 -if ! make "-j$(nproc)" i386-softmmu/fuzz; then +if ! make "-j$(nproc)" qemu-fuzz-i386; then fatal "Build failed. Please specify a compiler with fuzzing support"\ "using the \$CC and \$CXX environemnt variables"\ "\nFor example: CC=3Dclang CXX=3Dclang++ $0" fi =20 -for i in $(ldd ./i386-softmmu/qemu-fuzz-i386 | cut -f3 -d' '); do +for i in $(ldd ./qemu-fuzz-i386 | cut -f3 -d' '); do cp "$i" "$DEST_DIR/lib/" done -rm ./i386-softmmu/qemu-fuzz-i386 +rm qemu-fuzz-i386 =20 # Build a second time to build the final binary with correct rpath -../configure --bindir=3D"$DEST_DIR" --datadir=3D"$DEST_DIR/data/" --disabl= e-werror \ - --cc=3D"$CC" --cxx=3D"$CXX" --extra-cflags=3D"$EXTRA_CFLAGS" \ - --extra-ldflags=3D"-Wl,-rpath,'\$\$ORIGIN/lib'" -make "-j$(nproc)" i386-softmmu/fuzz +../configure --disable-werror --cc=3D"$CC" --cxx=3D"$CXX" --enable-fuzzing= \ + --prefix=3D"$DEST_DIR" --bindir=3D"$DEST_DIR" --datadir=3D"$DEST_DIR/d= ata/" \ + --extra-cflags=3D"$EXTRA_CFLAGS" --extra-ldflags=3D"-Wl,-rpath,'\$\$OR= IGIN/lib'" \ + --target-list=3D"i386-softmmu" +make "-j$(nproc)" qemu-fuzz-i386 V=3D1 =20 # Copy over the datadir cp -r ../pc-bios/ "$DEST_DIR/pc-bios" @@ -90,9 +92,9 @@ cp -r ../pc-bios/ "$DEST_DIR/pc-bios" # of available fuzz-targets. Copy over the qemu-fuzz-i386, naming it accor= ding # to each available fuzz target (See 05509c8e6d fuzz: select fuzz target u= sing # executable name) -for target in $(./i386-softmmu/qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}= '); +for target in $(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}'); do - cp ./i386-softmmu/qemu-fuzz-i386 "$DEST_DIR/qemu-fuzz-i386-target-$tar= get" + cp qemu-fuzz-i386 "$DEST_DIR/qemu-fuzz-i386-target-$target" done =20 echo "Done. The fuzzers are located in $DEST_DIR" diff --git a/softmmu/Makefile.objs b/softmmu/Makefile.objs deleted file mode 100644 index ebcfd15..0000000 --- a/softmmu/Makefile.objs +++ /dev/null @@ -1,2 +0,0 @@ -softmmu-main-y =3D softmmu/main.o -main.o-cflags :=3D $(GPROF_CFLAGS) $(SDL_CFLAGS) diff --git a/tests/Makefile.include b/tests/Makefile.include index b6d9661..c3874ca 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -457,7 +457,7 @@ build-tcg-tests-%: $(if $(CONFIG_PLUGIN),plugins) V=3D"$(V)" TARGET=3D"$*" guest-tests, \ "BUILD", "TCG tests for $*") =20 -run-tcg-tests-%: build-tcg-tests-% %/all +run-tcg-tests-%: build-tcg-tests-% all $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ SRC_PATH=3D$(SRC_PATH) SPEED=3D"$(SPEED)" \ @@ -485,7 +485,7 @@ QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CO= NFIG_LINUX)) =3D tests/qemu .PHONY: check-tests/check-block.sh check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) \ qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \ - $(patsubst %,%/all,$(filter %-softmmu,$(TARGET_DIRS))) + $(patsubst %-softmmu,qemu-system-%,$(filter %-softmmu,$(TARGET_DIRS))) @$< =20 # Python venv for running tests diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 77d1c1d..db9c0f5 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -57,8 +57,7 @@ def pick_default_qemu_bin(arch=3DNone): # qemu binary path does not match arch for powerpc, handle it if 'ppc64le' in arch: arch =3D 'ppc64' - qemu_bin_relative_path =3D os.path.join("%s-softmmu" % arch, - "qemu-system-%s" % arch) + qemu_bin_relative_path =3D "./qemu-system-%s" % arch if is_readable_executable_file(qemu_bin_relative_path): return qemu_bin_relative_path =20 diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebu= ild-expected-aml.sh index 76cd797..fc78770 100755 --- a/tests/data/acpi/rebuild-expected-aml.sh +++ b/tests/data/acpi/rebuild-expected-aml.sh @@ -12,7 +12,7 @@ # This work is licensed under the terms of the GNU GPLv2. # See the COPYING.LIB file in the top-level directory. =20 -qemu_bins=3D"x86_64-softmmu/qemu-system-x86_64 aarch64-softmmu/qemu-system= -aarch64" +qemu_bins=3D"./qemu-system-x86_64 ./qemu-system-aarch64" =20 if [ ! -e "tests/qtest/bios-tables-test" ]; then echo "Test: bios-tables-test is required! Run make check before this s= cript." diff --git a/tests/multiboot/run_test.sh b/tests/multiboot/run_test.sh index 98df91e..f968bf7 100755 --- a/tests/multiboot/run_test.sh +++ b/tests/multiboot/run_test.sh @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. =20 -QEMU=3D${QEMU:-"../../x86_64-softmmu/qemu-system-x86_64"} +QEMU=3D${QEMU:-"../../qemu-system-x86_64"} =20 run_qemu() { local kernel=3D$1 diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 0657f72..3ab859a 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -577,11 +577,11 @@ if [ -z "$QEMU_PROG" ] then if [ -x "$build_iotests/qemu" ]; then export QEMU_PROG=3D"$build_iotests/qemu" - elif [ -x "$build_root/${qemu_arch}-softmmu/qemu-system-${qemu_arch}" = ]; then - export QEMU_PROG=3D"$build_root/${qemu_arch}-softmmu/qemu-system-$= {qemu_arch}" + elif [ -x "$build_root/qemu-system-${qemu_arch}" ]; then + export QEMU_PROG=3D"$build_root/qemu-system-${qemu_arch}" else pushd "$build_root" > /dev/null - for binary in *-softmmu/qemu-system-* + for binary in qemu-system-* do if [ -x "$binary" ] then diff --git a/tests/qtest/fuzz/Makefile.include b/tests/qtest/fuzz/Makefile.= include deleted file mode 100644 index 5bde793..0000000 --- a/tests/qtest/fuzz/Makefile.include +++ /dev/null @@ -1,39 +0,0 @@ -QEMU_PROG_FUZZ=3Dqemu-fuzz-$(TARGET_NAME)$(EXESUF) - -fuzz-obj-y +=3D tests/qtest/libqtest.o -fuzz-obj-y +=3D $(libqos-obj-y) -fuzz-obj-y +=3D tests/qtest/fuzz/fuzz.o # Fuzzer skeleton -fuzz-obj-y +=3D tests/qtest/fuzz/fork_fuzz.o -fuzz-obj-y +=3D tests/qtest/fuzz/qos_fuzz.o -fuzz-obj-y +=3D tests/qtest/fuzz/qtest_wrappers.o - -# Targets -fuzz-obj-$(CONFIG_PCI_I440FX) +=3D tests/qtest/fuzz/i440fx_fuzz.o -fuzz-obj-$(CONFIG_VIRTIO_NET) +=3D tests/qtest/fuzz/virtio_net_fuzz.o -fuzz-obj-$(CONFIG_SCSI) +=3D tests/qtest/fuzz/virtio_scsi_fuzz.o - -FUZZ_CFLAGS +=3D -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest - -# Linker Script to force coverage-counters into known regions which we can= mark -# shared -FUZZ_LDFLAGS +=3D -Xlinker -T$(SRC_PATH)/tests/qtest/fuzz/fork_fuzz.ld - -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_inb -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_inw -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_inl -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_outb -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_outw -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_outl -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_readb -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_readw -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_readl -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_readq -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_writeb -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_writew -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_writel -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_writeq -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_memread -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_bufread -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_memwrite -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_bufwrite -FUZZ_LDFLAGS +=3D -Wl,-wrap,qtest_memset diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c index f45373f..86796bf 100644 --- a/tests/qtest/fuzz/i440fx_fuzz.c +++ b/tests/qtest/fuzz/i440fx_fuzz.c @@ -17,8 +17,8 @@ #include "tests/qtest/libqos/pci.h" #include "tests/qtest/libqos/pci-pc.h" #include "fuzz.h" -#include "fuzz/qos_fuzz.h" -#include "fuzz/fork_fuzz.h" +#include "qos_fuzz.h" +#include "fork_fuzz.h" =20 =20 #define I440FX_PCI_HOST_BRIDGE_CFG 0xcf8 diff --git a/tests/qtest/fuzz/meson.build b/tests/qtest/fuzz/meson.build new file mode 100644 index 0000000..bb0a3f2 --- /dev/null +++ b/tests/qtest/fuzz/meson.build @@ -0,0 +1,35 @@ +specific_fuzz_ss.add(files('fuzz.c', 'fork_fuzz.c', 'qos_fuzz.c', + 'qtest_wrappers.c'), qos) + +# Targets +specific_fuzz_ss.add(when: 'CONFIG_I440FX', if_true: files('i440fx_fuzz.c'= )) +specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio_net= _fuzz.c')) +specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_SCSI', if_true: files('virtio_sc= si_fuzz.c')) + +# unfortunately declare_dependency does not support link_depends, so +# this will be duplicated in meson.build +fork_fuzz =3D declare_dependency( + link_args: ['-fsanitize=3Dfuzzer', + '-Wl,-T,' + (meson.current_source_dir() / 'fork_fuzz.ld'), + '-Wl,-wrap,qtest_inb', + '-Wl,-wrap,qtest_inw', + '-Wl,-wrap,qtest_inl', + '-Wl,-wrap,qtest_outb', + '-Wl,-wrap,qtest_outw', + '-Wl,-wrap,qtest_outl', + '-Wl,-wrap,qtest_readb', + '-Wl,-wrap,qtest_readw', + '-Wl,-wrap,qtest_readl', + '-Wl,-wrap,qtest_readq', + '-Wl,-wrap,qtest_writeb', + '-Wl,-wrap,qtest_writew', + '-Wl,-wrap,qtest_writel', + '-Wl,-wrap,qtest_writeq', + '-Wl,-wrap,qtest_memread', + '-Wl,-wrap,qtest_bufread', + '-Wl,-wrap,qtest_memwrite', + '-Wl,-wrap,qtest_bufwrite', + '-Wl,-wrap,qtest_memset'] +) + +specific_fuzz_ss.add(fork_fuzz) diff --git a/tests/qtest/fuzz/qtest_wrappers.c b/tests/qtest/fuzz/qtest_wra= ppers.c index 713c830..0580f8d 100644 --- a/tests/qtest/fuzz/qtest_wrappers.c +++ b/tests/qtest/fuzz/qtest_wrappers.c @@ -12,7 +12,7 @@ */ =20 #include "qemu/osdep.h" -#include "cpu.h" +#include "hw/core/cpu.h" #include "exec/ioport.h" =20 #include "fuzz.h" diff --git a/tests/qtest/fuzz/virtio_net_fuzz.c b/tests/qtest/fuzz/virtio_n= et_fuzz.c index 277a9e2..0e873ab 100644 --- a/tests/qtest/fuzz/virtio_net_fuzz.c +++ b/tests/qtest/fuzz/virtio_net_fuzz.c @@ -61,7 +61,8 @@ static void virtio_net_fuzz_multi(QTestState *s, * backend. Otherwise, always place the input on a virtqueue. */ if (vqa.rx && sockfds_initialized) { - write(sockfds[0], Data, vqa.length); + int ignored =3D write(sockfds[0], Data, vqa.length); + (void) ignored; } else { vqa.rx =3D 0; uint64_t req_addr =3D guest_alloc(t_alloc, vqa.length); diff --git a/tests/qtest/fuzz/virtio_scsi_fuzz.c b/tests/qtest/fuzz/virtio_= scsi_fuzz.c index 3a9ea13..6ff6fab 100644 --- a/tests/qtest/fuzz/virtio_scsi_fuzz.c +++ b/tests/qtest/fuzz/virtio_scsi_fuzz.c @@ -12,10 +12,10 @@ =20 #include "qemu/osdep.h" =20 -#include "tests/qtest/libqtest.h" -#include "libqos/virtio-scsi.h" -#include "libqos/virtio.h" -#include "libqos/virtio-pci.h" +#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqos/virtio-scsi.h" +#include "tests/qtest/libqos/virtio.h" +#include "tests/qtest/libqos/virtio-pci.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_pci.h" #include "standard-headers/linux/virtio_scsi.h" diff --git a/tests/qtest/libqos/qgraph.h b/tests/qtest/libqos/qgraph.h index 1054326..5f63d35 100644 --- a/tests/qtest/libqos/qgraph.h +++ b/tests/qtest/libqos/qgraph.h @@ -226,7 +226,7 @@ typedef void *(*QOSBeforeTest) (GString *cmd_line, void= *arg); * my_test <--consumed_by-- my_interface <--produces--+ * * Assuming there the binary is - * QTEST_QEMU_BINARY=3Dx86_64-softmmu/qemu-system-x86_64 + * QTEST_QEMU_BINARY=3D./qemu-system-x86_64 * a valid test path will be: * "/x86_64/pc/other_node/my_driver/my_interface/my_test". * diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 30cb88d..8f8fdb1 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -234,7 +234,7 @@ foreach dir : target_dirs qtest_env =3D environment() qtest_env.set('QTEST_QEMU_IMG', './qemu-img') qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vm= state-daemon.sh') - qtest_env.set('QTEST_QEMU_BINARY', '@0@-softmmu/qemu-system-@0@'.format(= target_base)) + qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base) =20 foreach test : qtests # Executables are shared across targets, declare them only the first t= ime we diff --git a/tests/qtest/rtas-test.c b/tests/qtest/rtas-test.c index a7e83e7..16751db 100644 --- a/tests/qtest/rtas-test.c +++ b/tests/qtest/rtas-test.c @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) g_test_init(&argc, &argv, NULL); =20 if (strcmp(arch, "ppc64")) { - g_printerr("RTAS requires ppc64-softmmu/qemu-system-ppc64\n"); + g_printerr("RTAS requires qemu-system-ppc64\n"); exit(EXIT_FAILURE); } qtest_add_func("rtas/get-time-of-day", test_rtas_get_time_of_day); diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh index 102578c..7d714f9 100755 --- a/tests/tcg/configure.sh +++ b/tests/tcg/configure.sh @@ -193,11 +193,11 @@ for target in $target_list; do case $target in *-linux-user | *-bsd-user) echo "CONFIG_USER_ONLY=3Dy" >> $config_target_mak - echo "QEMU=3D\$(BUILD_DIR)/$target/qemu-$arch" >> $config_target_mak + echo "QEMU=3D\$(BUILD_DIR)/qemu-$arch" >> $config_target_mak ;; *-softmmu) echo "CONFIG_SOFTMMU=3Dy" >> $config_target_mak - echo "QEMU=3D\$(BUILD_DIR)/$target/qemu-system-$arch" >> $config_tar= get_mak + echo "QEMU=3D\$(BUILD_DIR)/qemu-system-$arch" >> $config_target_mak ;; esac =20 --=20 1.8.3.1