[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 2/9] make: ensure all members of libqemuutil.
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v5 2/9] make: ensure all members of libqemuutil.a are linked |
Date: |
Wed, 26 Aug 2015 09:25:39 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 08/26/2015 09:05 AM, Daniel P. Berrange wrote:
> The libqemuutil.a archive may contain QOM objects which are
> only indirectly referenced via __attribute__((constructor))
> annotations. Despite the constructor annotation the linker
> will think these objects are unused by the executable and
> so drop them when linking, to the system emulator. As a
> result the objects in question will be missing from QOM.
>
> Using the -Wl,--whole-archive flag instructs the linker
> to pull in everything in libqemuutil.a regardless of
> whether it thinks it is used or not.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> Makefile.target | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile.target b/Makefile.target
> index 3e7aafd..5b08f0f 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -180,8 +180,13 @@ all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
> $(QEMU_PROG_BUILD): config-devices.mak
>
> # build either PROG or PROGW
> +# We must use --whole-archive with libqemuutil.a otherwise the
> +# linker will drop any objects from the archive which are only
> +# indirectly referenced via __attribute__(constructor) annotations
> $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
> - $(call LINK, $(filter-out %.mak, $^))
> + $(call LINK, $(filter-out %.mak, $(sort $(all-obj-y)))) \
Why the added $(sort)? Should that be a separate patch?
> + -Wl,--whole-archive ../libqemuutil.a -Wl,--no-whole-archive \
> + ../libqemustub.a
Otherwise makes sense to me.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v5 0/9] Extract TLS handling code from VNC server, Daniel P. Berrange, 2015/08/26
- [Qemu-devel] [PATCH v5 2/9] make: ensure all members of libqemuutil.a are linked, Daniel P. Berrange, 2015/08/26
- Re: [Qemu-devel] [PATCH v5 2/9] make: ensure all members of libqemuutil.a are linked,
Eric Blake <=
- [Qemu-devel] [PATCH v5 3/9] crypto: introduce new base module for TLS credentials, Daniel P. Berrange, 2015/08/26
- [Qemu-devel] [PATCH v5 1/9] qapi: allow override of default enum prefix naming, Daniel P. Berrange, 2015/08/26
- [Qemu-devel] [PATCH v5 5/9] crypto: introduce new module for TLS x509 credentials, Daniel P. Berrange, 2015/08/26
- [Qemu-devel] [PATCH v5 8/9] ui: fix return type for VNC I/O functions to be ssize_t, Daniel P. Berrange, 2015/08/26