[libvirt] [PATCH] build: fix linking libqemutestdriver with LTO enabled

Andrea Bolognani abologna at redhat.com
Tue Jun 4 07:33:55 UTC 2019


On Mon, 2019-06-03 at 15:41 -0600, Jim Fehlig wrote:
> On 5/30/19 10:00 AM, Andrea Bolognani wrote:
> > Actually I'd go one further and adopt what Xen tests are doing:
> > there's an explicit
> > 
> >    libxl_LDADDS += $(LDADDS)
> > 
> > and then most tests include at least $(libxl_LDADDS) in their
> > _(LD|LIB)ADDs, whereas most QEMU tests need to use
> > 
> >    _(LD|LIB)ADD = $(qemu_LDADDS) $(LDADDS)
> > 
> > My suggestion would be to copy that approach, have
> > 
> >    qemu_LDADDS += $(LDADDS)
> > 
> > and then drop the extra $(LDADDS) from QEMU tests, which will not
> > only fix your linkin problem but also clean up Makefile.am pretty
> > nicely :)
> 
> Sorry for not noticing your reply before pushing. As it turns out your 
> suggestion is not as simple as I expected. The attached patch fails with link 
> errors such as
> 
> /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: 
> ../src/libvirt_probes.o:/home/jfehlig/virt/upstream/libvirt/src/libvirt_probes.o.dtrace-temp.c:15: 
> multiple definition of `libvirt_event_poll_add_handle_semaphore'; 
> ../src/libvirt_probes.o:/home/jfehlig/virt/upstream/libvirt/src/libvirt_probes.o.dtrace-temp.c:15: 
> first defined here
> /usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: 
> ../src/libvirt_probes.o:/home/jfehlig/virt/upstream/libvirt/src/libvirt_probes.o.dtrace-temp.c:24: 
> multiple definition of `libvirt_event_poll_update_handle_semaphore'; 
> ../src/libvirt_probes.o:/home/jfehlig/virt/upstream/libvirt/src/libvirt_probes.o.dtrace-temp.c:24: 
> first defined here
> 
> This is due to LDADDS including ../src/libvirt_probes.lo (PROBES_O) and 
> qemu_LDADDS including ../src/libvirt_qemu_probes.lo when WITH_DTRACE_PROBES is 
> defined. I tried a couple of approaches to fixing this but found nothing 
> satisfying. (More) Suggestions welcomed :-).

Yeah, it's not as straightforward as I assumed it would be: I tried
it too after sending the email, and bumped into the very same issue.

I have something almost reasonable in a local branch, I'll polish it
up in the next few days and then post it.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list