All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Questions about gcc linker errors in crypto sub-directory
@ 2016-09-26  9:03 Gonglei (Arei)
  2016-09-26  9:13 ` Daniel P. Berrange
  0 siblings, 1 reply; 6+ messages in thread
From: Gonglei (Arei) @ 2016-09-26  9:03 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel

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
 
 # Let the userspace emulators avoid linking gnutls/etc
 crypto-aes-obj-y = aes.o

Any others do I need to change? Thanks!

Regards,
-Gonglei

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Questions about gcc linker errors in crypto sub-directory
  2016-09-26  9:03 [Qemu-devel] Questions about gcc linker errors in crypto sub-directory Gonglei (Arei)
@ 2016-09-26  9:13 ` Daniel P. Berrange
  2016-09-26  9:19   ` Gonglei (Arei)
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel P. Berrange @ 2016-09-26  9:13 UTC (permalink / raw)
  To: Gonglei (Arei); +Cc: qemu-devel

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"

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 :|

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Questions about gcc linker errors in crypto sub-directory
  2016-09-26  9:13 ` Daniel P. Berrange
@ 2016-09-26  9:19   ` Gonglei (Arei)
  2016-09-27 12:51     ` Daniel P. Berrange
  0 siblings, 1 reply; 6+ messages in thread
From: Gonglei (Arei) @ 2016-09-26  9:19 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel






> -----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. 

Thank you so much!

Regards,
-Gonglei

> 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 :|

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Questions about gcc linker errors in crypto sub-directory
  2016-09-26  9:19   ` Gonglei (Arei)
@ 2016-09-27 12:51     ` Daniel P. Berrange
  2016-09-28  1:42       ` Gonglei (Arei)
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel P. Berrange @ 2016-09-27 12:51 UTC (permalink / raw)
  To: Gonglei (Arei); +Cc: qemu-devel

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 :|

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Questions about gcc linker errors in crypto sub-directory
  2016-09-27 12:51     ` Daniel P. Berrange
@ 2016-09-28  1:42       ` Gonglei (Arei)
  2016-09-28  9:09         ` Daniel P. Berrange
  0 siblings, 1 reply; 6+ messages in thread
From: Gonglei (Arei) @ 2016-09-28  1:42 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel

> -----Original Message-----
> From: Daniel P. Berrange [mailto:berrange@redhat.com]
> Sent: Tuesday, September 27, 2016 8:52 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: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.
> 
Sounds reasonable and make senses. At present situation, I need
to do below changes for crypto subdirectory:

diff --git a/Makefile.objs b/Makefile.objs
index 6d5ddcf..f1a8f13 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -78,6 +78,7 @@ common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
 
 common-obj-$(CONFIG_FDT) += device_tree.o
 
+common-obj-y += crypto/
 ######################################################################
 # qapi
 
diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs
index a36d2d9..2632cbc 100644
--- a/crypto/Makefile.objs
+++ b/crypto/Makefile.objs
@@ -27,6 +27,10 @@ crypto-obj-y += block.o
 crypto-obj-y += block-qcow.o
 crypto-obj-y += block-luks.o
 
+# cryptodev file is specific to system emulators, so must only be linked
+# to the system emulator targets. 
+common-obj-y += cryptodev.o
+
 # Let the userspace emulators avoid linking gnutls/etc
 crypto-aes-obj-y = aes.o

I'll move them to backends/ directory.  But I still hope you can help to
review cryptdoev stuff in the following virtio-crypto patch serial versions, 
thanks in advance :)

Regards,
-Gonglei


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Questions about gcc linker errors in crypto sub-directory
  2016-09-28  1:42       ` Gonglei (Arei)
@ 2016-09-28  9:09         ` Daniel P. Berrange
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel P. Berrange @ 2016-09-28  9:09 UTC (permalink / raw)
  To: Gonglei (Arei); +Cc: qemu-devel

On Wed, Sep 28, 2016 at 01:42:33AM +0000, Gonglei (Arei) wrote:
> > -----Original Message-----
> > From: Daniel P. Berrange [mailto:berrange@redhat.com]
> > Sent: Tuesday, September 27, 2016 8:52 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: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.
> > 
> Sounds reasonable and make senses. At present situation, I need
> to do below changes for crypto subdirectory:
> 
> diff --git a/Makefile.objs b/Makefile.objs
> index 6d5ddcf..f1a8f13 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -78,6 +78,7 @@ common-obj-$(CONFIG_SECCOMP) += qemu-seccomp.o
>  
>  common-obj-$(CONFIG_FDT) += device_tree.o
>  
> +common-obj-y += crypto/
>  ######################################################################
>  # qapi
>  
> diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs
> index a36d2d9..2632cbc 100644
> --- a/crypto/Makefile.objs
> +++ b/crypto/Makefile.objs
> @@ -27,6 +27,10 @@ crypto-obj-y += block.o
>  crypto-obj-y += block-qcow.o
>  crypto-obj-y += block-luks.o
>  
> +# cryptodev file is specific to system emulators, so must only be linked
> +# to the system emulator targets. 
> +common-obj-y += cryptodev.o
> +
>  # Let the userspace emulators avoid linking gnutls/etc
>  crypto-aes-obj-y = aes.o
> 
> I'll move them to backends/ directory.  But I still hope you can help to
> review cryptdoev stuff in the following virtio-crypto patch serial versions, 
> thanks in advance :)

Sure, i'll review any crypto related stuff.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-09-28  9:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26  9:03 [Qemu-devel] Questions about gcc linker errors in crypto sub-directory Gonglei (Arei)
2016-09-26  9:13 ` Daniel P. Berrange
2016-09-26  9:19   ` Gonglei (Arei)
2016-09-27 12:51     ` Daniel P. Berrange
2016-09-28  1:42       ` Gonglei (Arei)
2016-09-28  9:09         ` Daniel P. Berrange

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.