From patchwork Wed Sep 28 01:42:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 9353047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1D92560757 for ; Wed, 28 Sep 2016 01:43:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06F8029244 for ; Wed, 28 Sep 2016 01:43:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBFFE29249; Wed, 28 Sep 2016 01:43:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0E0C829244 for ; Wed, 28 Sep 2016 01:43:12 +0000 (UTC) Received: from localhost ([::1]:55365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp3tv-0001xU-6q for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Sep 2016 21:43:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp3td-0001xB-Un for qemu-devel@nongnu.org; Tue, 27 Sep 2016 21:42:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bp3tZ-00065E-Op for qemu-devel@nongnu.org; Tue, 27 Sep 2016 21:42:52 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:26038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bp3tY-000632-UG for qemu-devel@nongnu.org; Tue, 27 Sep 2016 21:42:49 -0400 Received: from 172.24.1.136 (EHLO SZXEMA417-HUB.china.huawei.com) ([172.24.1.136]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DRQ77713; Wed, 28 Sep 2016 09:42:35 +0800 (CST) Received: from SZXEMA503-MBS.china.huawei.com ([169.254.6.130]) by SZXEMA417-HUB.china.huawei.com ([10.82.72.34]) with mapi id 14.03.0235.001; Wed, 28 Sep 2016 09:42:34 +0800 From: "Gonglei (Arei)" To: "Daniel P. Berrange" Thread-Topic: Questions about gcc linker errors in crypto sub-directory Thread-Index: AdIX1OKUy3PfS6fTSwe2phqsamr3cv//fLkA//95N7CAAlYIgP/+pONA Date: Wed, 28 Sep 2016 01:42:33 +0000 Message-ID: <33183CC9F5247A488A2544077AF19020B03DB501@SZXEMA503-MBS.china.huawei.com> References: <33183CC9F5247A488A2544077AF19020B03D9371@SZXEMA503-MBS.china.huawei.com> <20160926091354.GD18393@redhat.com> <33183CC9F5247A488A2544077AF19020B03D93DC@SZXEMA503-MBS.china.huawei.com> <20160927125155.GO3967@redhat.com> In-Reply-To: <20160927125155.GO3967@redhat.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.177.18.62] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.57EB200D.0036, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=169.254.6.130, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: cd853f1c0bc4049537dabfd330cdddae X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 58.251.152.64 Subject: Re: [Qemu-devel] Questions about gcc linker errors in crypto sub-directory X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP > -----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: 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 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