Message ID | 20200804170055.2851-9-thuth@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Run cross-compilation build tests in the gitlab-CI | expand |
On 8/4/20 10:00 AM, Thomas Huth wrote: > Otherwise there is a linker error with MinGW while compiling the tests: > > LINK tests/test-timed-average.exe > libqemuutil.a(main-loop.o): In function `qemu_notify_event': > /builds/huth/qemu/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 > /builds/huth/qemu/rules.mak:124: recipe for target > 'tests/test-timed-average.exe' failed > > Signed-off-by: Thomas Huth <thuth@redhat.com> > --- > stubs/notify-event.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) That doesn't make sense. Since the symbol is satisfied from main-loop.c, it should not be pulled in from libqemuutil.a. What's really happening here? r~
On 04/08/2020 19.50, Richard Henderson wrote: > On 8/4/20 10:00 AM, Thomas Huth wrote: >> Otherwise there is a linker error with MinGW while compiling the tests: >> >> LINK tests/test-timed-average.exe >> libqemuutil.a(main-loop.o): In function `qemu_notify_event': >> /builds/huth/qemu/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 >> /builds/huth/qemu/rules.mak:124: recipe for target >> 'tests/test-timed-average.exe' failed >> >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> --- >> stubs/notify-event.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > That doesn't make sense. Since the symbol is satisfied from main-loop.c, it > should not be pulled in from libqemuutil.a. > > What's really happening here? Honestly, I don't have a clue. But since commit ebedb37c8d2aa4775, both the code from util/ and from stubs/ are put into the same library, libqemuutil.a, which is causing the trouble here, I guess. Maybe the linker pulled in the code from the stub first, then some other part used another function from util/main-loop.c which caused the linker to pull in main-loop.o, too, so that it finally found that there is a clash? ... but that's just a plain guess, of course. Paolo (as author of commit ebedb37c8d2), do you have an idea what might be going on here? Thomas
On 04/08/20 20:20, Thomas Huth wrote: > On 04/08/2020 19.50, Richard Henderson wrote: >> On 8/4/20 10:00 AM, Thomas Huth wrote: >>> Otherwise there is a linker error with MinGW while compiling the tests: >>> >>> LINK tests/test-timed-average.exe >>> libqemuutil.a(main-loop.o): In function `qemu_notify_event': >>> /builds/huth/qemu/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 >>> /builds/huth/qemu/rules.mak:124: recipe for target >>> 'tests/test-timed-average.exe' failed >>> >>> Signed-off-by: Thomas Huth <thuth@redhat.com> >>> --- >>> stubs/notify-event.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> That doesn't make sense. Since the symbol is satisfied from main-loop.c, it >> should not be pulled in from libqemuutil.a. >> >> What's really happening here? > > Honestly, I don't have a clue. But since commit ebedb37c8d2aa4775, both > the code from util/ and from stubs/ are put into the same library, > libqemuutil.a, which is causing the trouble here, I guess. > Maybe the linker pulled in the code from the stub first, then some other > part used another function from util/main-loop.c which caused the > linker to pull in main-loop.o, too, so that it finally found that there > is a clash? ... but that's just a plain guess, of course. Paolo (as > author of commit ebedb37c8d2), do you have an idea what might be going > on here? I think your analysis is right but is the stub needed at all, since te linker can include util/main-loop.c instead? Paolo
diff --git a/stubs/notify-event.c b/stubs/notify-event.c index 827bb52d1a..75d98f4a79 100644 --- a/stubs/notify-event.c +++ b/stubs/notify-event.c @@ -1,6 +1,6 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" -void qemu_notify_event(void) +void __attribute__((weak)) qemu_notify_event(void) { }
Otherwise there is a linker error with MinGW while compiling the tests: LINK tests/test-timed-average.exe libqemuutil.a(main-loop.o): In function `qemu_notify_event': /builds/huth/qemu/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 /builds/huth/qemu/rules.mak:124: recipe for target 'tests/test-timed-average.exe' failed Signed-off-by: Thomas Huth <thuth@redhat.com> --- stubs/notify-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)