From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1borrg-00049c-6C for qemu-devel@nongnu.org; Tue, 27 Sep 2016 08:52:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1borrc-0003hz-Qg for qemu-devel@nongnu.org; Tue, 27 Sep 2016 08:52:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1borrc-0003hm-I8 for qemu-devel@nongnu.org; Tue, 27 Sep 2016 08:52:00 -0400 Date: Tue, 27 Sep 2016 13:51:55 +0100 From: "Daniel P. Berrange" Message-ID: <20160927125155.GO3967@redhat.com> Reply-To: "Daniel P. Berrange" References: <33183CC9F5247A488A2544077AF19020B03D9371@SZXEMA503-MBS.china.huawei.com> <20160926091354.GD18393@redhat.com> <33183CC9F5247A488A2544077AF19020B03D93DC@SZXEMA503-MBS.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <33183CC9F5247A488A2544077AF19020B03D93DC@SZXEMA503-MBS.china.huawei.com> Subject: Re: [Qemu-devel] Questions about gcc linker errors in crypto sub-directory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" Cc: "qemu-devel@nongnu.org" On Mon, Sep 26, 2016 at 09:19:36AM +0000, Gonglei (Arei) wrote: > > > > > > > -----Original Message----- > > From: Daniel P. Berrange [mailto:berrange@redhat.com] > > Sent: Monday, September 26, 2016 5:14 PM > > To: Gonglei (Arei) > > Cc: qemu-devel@nongnu.org > > Subject: Re: Questions about gcc linker errors in crypto sub-directory > > > > On Mon, Sep 26, 2016 at 09:03:45AM +0000, Gonglei (Arei) wrote: > > > Hi Daniel, > > > > > > I'm coding cryptodev-vhost-user.c as a new cryptodev backend, > > > but the gcc report some linker errors: > > > > > > crypto/cryptodev-vhost-user.o: In function > > `qcrypto_cryptodev_vhost_crypto_cleanup': > > > /mnt/sdb/gonglei/qemu.git/qemu/crypto/cryptodev-vhost-user.c:87: > > undefined reference to `vhost_dev_cleanup' > > > crypto/cryptodev-vhost-user.o: In function > > `qcrypto_cryptodev_vhost_crypto_init': > > > /mnt/sdb/gonglei/qemu.git/qemu/crypto/cryptodev-vhost-user.c:126: > > undefined reference to `vhost_dev_init' > > > crypto/cryptodev-vhost-user.o: In function > > `qcrypto_cryptodev_vhost_user_opened': > > > /mnt/sdb/gonglei/qemu.git/qemu/crypto/cryptodev-vhost-user.c:187: > > undefined reference to `qemu_chr_find' > > > /mnt/sdb/gonglei/qemu.git/qemu/crypto/cryptodev-vhost-user.c:194: > > undefined reference to `qemu_chr_fe_claim_no_fail' > > > crypto/cryptodev-vhost-user.o: In function > > `qcrypto_cryptodev_vhost_user_event': > > > /mnt/sdb/gonglei/qemu.git/qemu/crypto/cryptodev-vhost-user.c:213: > > undefined reference to `qemu_chr_set_reconnect_time' > > > crypto/cryptodev-vhost-user.o: In function > > `qcrypto_cryptodev_vhost_user_init': > > > /mnt/sdb/gonglei/qemu.git/qemu/crypto/cryptodev-vhost-user.c:257: > > undefined reference to `qemu_chr_add_handlers' > > > crypto/cryptodev-vhost-user.o: In function > > `qcrypto_cryptodev_vhost_user_finalize': > > > /mnt/sdb/gonglei/qemu.git/qemu/crypto/cryptodev-vhost-user.c:353: > > undefined reference to `qemu_chr_add_handlers' > > > /mnt/sdb/gonglei/qemu.git/qemu/crypto/cryptodev-vhost-user.c:354: > > undefined reference to `qemu_chr_fe_release' > > > collect2: ld returned 1 exit status > > > make: *** [qemu-nbd] Error 1 > > > > > > Currently I only change the crypto/Makefile.objs: > > > > > > diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs > > > index b9ad26a..575f64e 100644 > > > --- a/crypto/Makefile.objs > > > +++ b/crypto/Makefile.objs > > > @@ -28,6 +28,7 @@ crypto-obj-y += block-qcow.o > > > crypto-obj-y += block-luks.o > > > crypto-obj-y += cryptodev.o > > > crypto-obj-y += cryptodev-builtin.o > > > +crypto-obj-y += cryptodev-vhost-user.o > > > > The $(crypto-obj-y) variable is intended to only contain general purpose > > crypto code, since it needs to be linked to all QEMU programs. Your > > cryptodev file is specific to system emulators, so must only be linked > > to the system emulator targets. Thus, it should not be added to the > > crypto-obj-y variable. > > > > It probably needs to be added to either common-obj-y or obj-y - I can't > > remember which is "best" > > > common-obj-y is fine! So all cryptodev stuff should be use > $( crypto-obj-y) variable, right? I'll change them in the next version. Looking at this again, it actually makes me think that your cryptodev stuff would be better in the backends/ directory. That would mean the crypto/ directory is kept as the place for generic crypto infrastructure, and avoiding system emulator specific device backend code. The backends/Makefile.objs is already setup to use common-obj-y and builds various other device backend models. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|