From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUcaB-0008SX-Ni for qemu-devel@nongnu.org; Wed, 26 Aug 2015 11:25:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUca6-00048G-Au for qemu-devel@nongnu.org; Wed, 26 Aug 2015 11:25:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUca6-00047y-2u for qemu-devel@nongnu.org; Wed, 26 Aug 2015 11:25:42 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 2C47B8E3DC for ; Wed, 26 Aug 2015 15:25:41 +0000 (UTC) References: <1440601524-30316-1-git-send-email-berrange@redhat.com> <1440601524-30316-3-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <55DDDA73.8020507@redhat.com> Date: Wed, 26 Aug 2015 09:25:39 -0600 MIME-Version: 1.0 In-Reply-To: <1440601524-30316-3-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lPDppPr0AHCJBaKkWQSE6btdunHuVo43L" Subject: Re: [Qemu-devel] [PATCH v5 2/9] make: ensure all members of libqemuutil.a are linked List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Paolo Bonzini , Gerd Hoffmann This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lPDppPr0AHCJBaKkWQSE6btdunHuVo43L Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. >=20 > Signed-off-by: Daniel P. Berrange > --- > Makefile.target | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) >=20 > 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) +=3D $(block-obj-y) > $(QEMU_PROG_BUILD): config-devices.mak > =20 > # 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 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --lPDppPr0AHCJBaKkWQSE6btdunHuVo43L Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV3dp0AAoJEKeha0olJ0NqJp8H/3DGlCGsVeESJQGCvCytRcIq PUlKsRQ7iR6GfvIo5gy/ddruL20rRV/Pwhqu5F5aVvYSsPWOClMeJRTO/mAwEkj6 KTAozHqqvPXsHMsL+ICDhPz4JSSqRyQqTvx68wgte15NHWz+ew0ds0T8+9peJK7/ bBYJE4AAfUIW2bv8Y9/u3eoac0OnCPdJDEoSoe2/Po8DL4EsvGER74rQZR+3A/l2 a0cor5mFV5NLSjFQ3ZzKTqfELT8E5COYjBlD49Ix74e+YHo2io/a0H0we+x1b9Yo J4UfGUMXClA7EWK+mULTzhcRZOgfNnp48JdcnTjc6l2bGCDMQPYGDhHmcCRy7vw= =mSh0 -----END PGP SIGNATURE----- --lPDppPr0AHCJBaKkWQSE6btdunHuVo43L--