stubs: Fix notify-event stub linkage error on MinGW
v2 cover stubs: Fix notify-event stub linkage error on MinGW
2 trivial patches to fix the link error reported by Thomas:
LINK tests/test-timed-average.exe
libqemuutil.a(main-loop.o): In function `qemu_notify_event':
util/main-loop.c:139: multiple definition of `qemu_notify_event' tests/test-timed-average.o:/builds/huth/qemu/tests/../stubs/notify-event.c:5: first defined here
collect2: error: ld returned 1 exit status
rules.mak:124: recipe for target 'tests/test-timed-average.exe' failed
Philippe Mathieu-Daudé (2):
exec: Restrict icount to softmmu
stubs: Remove qemu_notify_event()
include/sysemu/cpus.h | 4 ++++ exec.c | 4 ---- softmmu/cpus.c | 7 +++++++ stubs/cpu-get-icount.c | 2 +- stubs/notify-event.c | 6 ------ stubs/Makefile.objs | 1 - 6 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 stubs/notify-event.c
Signature · 1 line
2.21.3
PATCH v2 1/2 exec: Restrict icount to softmmu
'icount' feature is only meaningful when using softmmu. Move it out of the globally used exec.c, and define it as 'false' in user-mode emulation.
--- include/sysemu/cpus.h | 4 ++++ exec.c | 4 ---- softmmu/cpus.c | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-)
include/sysemu/cpus.h +4 -0
@@ -11,9 +11,13 @@ void pause_all_vcpus(void);void cpu_stop_current (void );void cpu_ticks_init (void ); +#if !defined(CONFIG_USER_ONLY )void configure_icount (QemuOpts *opts,Error **errp);extern int use_icount;extern int icount_align_option; +#else +#define use_icount false +#endif /* drift information for info jit command */ extern int64_t max_delay;
exec.c +0 -4
@@ -102,10 +102,6 @@ uintptr_t qemu_host_page_size;intptr_t qemu_host_page_mask;#if !defined(CONFIG_USER_ONLY ) -/* 0 = Do not count executed instructions. -1 = Precise instruction counting. -2 = Adaptive rate instruction counting. */ -int use_icount;typedef struct PhysPageEntry PhysPageEntry ;
softmmu/cpus.c +7 -0
@@ -81,6 +81,13 @@#endif /* CONFIG_LINUX */ +/* +* 0 = Do not count executed instructions. +* 1 = Precise instruction counting. +* 2 = Adaptive rate instruction counting. +*/ +int use_icount; +static QemuMutex qemu_global_mutex;int64_t max_delay;
Signature · 1 line
2.21.3
PATCH v2 2/2 stubs: Remove qemu_notify_event()
In reply to Philippe Mathieu-DaudéWe don't need the qemu_notify_event() stub anymore.
--- stubs/cpu-get-icount.c | 2 +- stubs/notify-event.c | 6 ------ stubs/Makefile.objs | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 stubs/notify-event.c
stubs/cpu-get-icount.c +1 -1
@@ -17,5 +17,5 @@ int64_t cpu_get_icount_raw(void)void qemu_timer_notify_cb (void *opaque,QEMUClockType type) { -qemu_notify_event (); +abort (); }
stubs/notify-event.c deleted +0 -6
@@ -1,6 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu/main-loop.h" - -void qemu_notify_event (void ) -{ -}
stubs/Makefile.objs +0 -1
@@ -12,7 +12,6 @@ stub-obj-y += isa-bus.o stub-obj-$(CONFIG_LINUX_AIO) += linux-aio.o stub-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o stub-obj-y += monitor-core.o -stub-obj-y += notify-event.o stub-obj-y += pci-bus.o stub-obj-y += qmp_memory_device.o stub-obj-y += qtest.o
Signature · 1 line
2.21.3
Re: [PATCH-for-5.1 v2 2/2] stubs: Remove qemu_notify_event()
Quoted 15 lines · Philippe Mathieu-Daudé
We don't need the
qemu_notify_event()stub anymore.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- stubs/cpu-get-icount.c | 2 +- stubs/notify-event.c | 6 ------ stubs/Makefile.objs | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 stubs/notify-event.cstubs/cpu-get-icount.c +0
-0
stubs/cpu-get-icount.c int64_t cpu_get_icount_raw(void) · line 20
Quoted 5 lines
stubs/cpu-get-icount.c +1
-1@@ -17,5 +17,5 @@ int64_t cpu_get_icount_raw(void)void qemu_timer_notify_cb (void *opaque,QEMUClockType type) { -qemu_notify_event (); +abort ();
This abort makes iotest 077 fail.
I think I'll simply repost without it.
Quoted 26 lines
stubs/cpu-get-icount.c +0
-0}stubs/notify-event.c deleted +0
-6@@ -1,6 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu/main-loop.h" - -void qemu_notify_event (void ) -{ -}stubs/Makefile.objs +0
-1@@ -12,7 +12,6 @@ stub-obj-y += isa-bus.o stub-obj-$(CONFIG_LINUX_AIO) += linux-aio.o stub-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o stub-obj-y += monitor-core.o -stub-obj-y += notify-event.o stub-obj-y += pci-bus.o stub-obj-y += qmp_memory_device.o stub-obj-y += qtest.o
Re: [PATCH-for-5.1 v2 2/2] stubs: Remove qemu_notify_event()
Quoted 17 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé
We don't need the
qemu_notify_event()stub anymore.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- stubs/cpu-get-icount.c | 2 +- stubs/notify-event.c | 6 ------ stubs/Makefile.objs | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 stubs/notify-event.cstubs/cpu-get-icount.c +0
-0@@ -17,5 +17,5 @@ int64_t cpu_get_icount_raw(void)
Quoted 7 lines
stubs/cpu-get-icount.c int64_t cpu_get_icount_raw(void) · line 20
Quoted 4 lines
stubs/cpu-get-icount.c +1
-1void qemu_timer_notify_cb (void *opaque,QEMUClockType type) { -qemu_notify_event (); +abort ();This abort makes iotest 077 fail.
I think I'll simply repost without it.
I don't understand what from 077 trigger this callback, but I confirm doing nothing is safe, ...
Quoted 13 lines
stubs/notify-event.c line 5
Quoted 13 lines
stubs/cpu-get-icount.c +0
-0}stubs/notify-event.c deleted +0
-5@@ -1,6 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu/main-loop.h" - -void qemu_notify_event (void ) -{
... as this is the current behavior.
Quoted 15 lines
Quoted 14 lines
stubs/notify-event.c deleted +0
-1-}stubs/Makefile.objs +0
-1@@ -12,7 +12,6 @@ stub-obj-y += isa-bus.o stub-obj-$(CONFIG_LINUX_AIO) += linux-aio.o stub-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o stub-obj-y += monitor-core.o -stub-obj-y += notify-event.o stub-obj-y += pci-bus.o stub-obj-y += qmp_memory_device.o stub-obj-y += qtest.o
Re: [PATCH-for-5.1 v2 2/2] stubs: Remove qemu_notify_event()
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé
We don't need the
qemu_notify_event()stub anymore.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- stubs/cpu-get-icount.c | 2 +- stubs/notify-event.c | 6 ------ stubs/Makefile.objs | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 stubs/notify-event.cstubs/cpu-get-icount.c +0
-0@@ -17,5 +17,5 @@ int64_t cpu_get_icount_raw(void)Quoted 7 lines
stubs/cpu-get-icount.c int64_t cpu_get_icount_raw(void) · line 20
Quoted 4 lines
stubs/cpu-get-icount.c +1
-1void qemu_timer_notify_cb (void *opaque,QEMUClockType type) { -qemu_notify_event (); +abort ();This abort makes iotest 077 fail.
I think I'll simply repost without it.I don't understand what from 077 trigger this callback, but I confirm doing nothing is safe, ...
Quoted 1 line
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
stubs/cpu-get-icount.c +0
-0}stubs/notify-event.c deleted +0
-0Quoted 8 lines
stubs/notify-event.c line 5
Quoted 8 lines
stubs/notify-event.c deleted +0
-5@@ -1,6 +0,0 @@ -#include "qemu/osdep.h" -#include "qemu/main-loop.h" - -void qemu_notify_event (void ) -{... as this is the current behavior.
But could we maybe end up in a scenario, where the stub from stubs/cpu-get-icount.c is used, which then calls the real implementation of qemu_notify_event() in main-loop.c ?
Thomas
Re: [PATCH-for-5.1 v2 2/2] stubs: Remove qemu_notify_event()
Quoted 4 lines · Thomas Huth
Quoted 1 line
... as this is the current behavior.
But could we maybe end up in a scenario, where the stub from
stubs/cpu-get-icount.cis used, which then calls the real implementation ofqemu_notify_event()inmain-loop.c?
Yes, definitely. It would happen in tools such as qemu-img/qemu-io and it's the correct behavior.
Paolo
Quoted 13 lines · Philippe Mathieu-Daudé
2 trivial patches to fix the link error reported by Thomas:
LINK tests/test-timed-average.exe
libqemuutil.a(main-loop.o): In function `qemu_notify_event':
util/main-loop.c:139: multiple definition of `qemu_notify_event' tests/test-timed-average.o:/builds/huth/qemu/tests/../stubs/notify-event.c:5: first defined here
collect2: error: ld returned 1 exit status
rules.mak:124: recipe for target 'tests/test-timed-average.exe' failedPhilippe Mathieu-Daudé (2):
exec: Restrict icount to softmmu
stubs: Removeqemu_notify_event()
Quoted 9 lines
include/sysemu/cpus.h | 4 ++++ exec.c | 4 ---- softmmu/cpus.c | 7 +++++++ stubs/cpu-get-icount.c | 2 +- stubs/notify-event.c | 6 ------ stubs/Makefile.objs | 1 - 6 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 stubs/notify-event.c
Patch 1 will be superseded by Claudio's refactoring. For patch 2 please respin according to the review.
Paolo
Quoted 24 lines · Paolo Bonzini
Quoted 13 lines · Philippe Mathieu-Daudé
2 trivial patches to fix the link error reported by Thomas:
LINK tests/test-timed-average.exe
libqemuutil.a(main-loop.o): In function `qemu_notify_event':
util/main-loop.c:139: multiple definition of `qemu_notify_event' tests/test-timed-average.o:/builds/huth/qemu/tests/../stubs/notify-event.c:5: first defined here
collect2: error: ld returned 1 exit status
rules.mak:124: recipe for target 'tests/test-timed-average.exe' failedPhilippe Mathieu-Daudé (2):
exec: Restrict icount to softmmu
stubs: Removeqemu_notify_event()Quoted 9 lines
include/sysemu/cpus.h | 4 ++++ exec.c | 4 ---- softmmu/cpus.c | 7 +++++++ stubs/cpu-get-icount.c | 2 +- stubs/notify-event.c | 6 ------ stubs/Makefile.objs | 1 - 6 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 stubs/notify-event.c
Quoted 2 lines
Patch 1 will be superseded by Claudio's refactoring. For patch 2 please respin according to the review.
The respin is available as <[email protected]>:
https://www.mail-archive.com/[email protected]/msg727616.html