From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 16DC08E85 for ; Wed, 14 Sep 2016 15:42:50 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 14 Sep 2016 06:42:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,334,1470726000"; d="scan'208";a="878696552" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.117]) ([10.237.220.117]) by orsmga003.jf.intel.com with ESMTP; 14 Sep 2016 06:42:48 -0700 To: Zoltan Kiss , "dev@dpdk.org" , "Zhang, Helin" , Jingjing Wu References: <1469034676-2424-1-git-send-email-zoltan.kiss@schaman.hu> Cc: Matias Elo , "Gonzalez Monroy, Sergio" , "damarion@cisco.com" , "thomas.monjalon@6wind.com" From: Ferruh Yigit Message-ID: <8224a47e-99dd-2a02-3c58-00dba47a2b54@intel.com> Date: Wed, 14 Sep 2016 14:42:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1469034676-2424-1-git-send-email-zoltan.kiss@schaman.hu> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: remove weak symbols X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Sep 2016 13:42:51 -0000 On 7/20/2016 6:11 PM, Zoltan Kiss wrote: > Using weak symbols have a few issues with static linking: > > - normally the linker searches the .o files already linked, if your weak > one is there, it won't check if there is a strong version > - unless the symbol is directly referred, but it's not the right thing to > rely on > - or --whole-archive specified in the command line, which pulls in a lot > of unwanted stuff > - whole-archive also makes libtool dropping the library from the command > line, which is what should happen with dynamic linking, but not with > static (observed on Ubuntu 14.04). This is an important bug if you > build a static library depending on DPDK > > This patch merges the two version and make the behaviour rely on the > config. > > If we can agree in the concept, I can send a series to fix this for the > other weak functions. > > Signed-off-by: Zoltan Kiss > --- + i40e maintainers I personally prefer macros against weak symbols, because dpdk can be compiled as static and dynamic libraries, and weak symbols are not working fine when compiled as static. > > Notes: > v2: fix commit message > > drivers/net/i40e/i40e_rxtx.c | 36 +++++++++++++++++++++++++++++++++++- > drivers/net/i40e/i40e_rxtx_vec.c | 36 ------------------------------------ > 2 files changed, 35 insertions(+), 37 deletions(-) > > diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c > index d3cfb98..ad34d3a 100644 > --- a/drivers/net/i40e/i40e_rxtx.c > +++ b/drivers/net/i40e/i40e_rxtx.c > @@ -3278,10 +3278,44 @@ i40e_set_tx_function(struct rte_eth_dev *dev) > } > > /* Stubs needed for linkage when CONFIG_RTE_I40E_INC_VECTOR is set to 'n' */ > -int __attribute__((weak)) > +int __attribute__((cold)) > i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev __rte_unused *dev) > { > +#ifndef RTE_LIBRTE_I40E_INC_VECTOR > return -1; > +#else This moves all vector implementation into non-vector file, this is bad for maintaining. Why not: in i40e_rxtx.c: #ifndef RTE_LIBRTE_I40E_INC_VECTOR i40e_rx_vec_dev_conf_condition_check() { return -1; } #endif in i40e_rxtx_vec.c: No change, keep i40e_rx_vec_dev_conf_condition_check() as it is. Thanks, ferruh