From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga07.intel.com (mga07.intel.com [134.134.136.100])
 by dpdk.org (Postfix) with ESMTP id B33CE1B148
 for <dev@dpdk.org>; Wed, 10 Apr 2019 16:02:36 +0200 (CEST)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 10 Apr 2019 07:02:35 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="222234492"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.35])
 by orsmga001.jf.intel.com with SMTP; 10 Apr 2019 07:02:33 -0700
Received: by  (sSMTP sendmail emulation); Wed, 10 Apr 2019 15:02:32 +0100
Date: Wed, 10 Apr 2019 15:02:32 +0100
From: Bruce Richardson <bruce.richardson@intel.com>
To: Aaron Conole <aconole@redhat.com>
Cc: konstantin.ananyev@intel.com, dev@dpdk.org
Message-ID: <20190410140232.GD718@bricha3-MOBL.ger.corp.intel.com>
References: <20190410134517.63896-1-bruce.richardson@intel.com>
 <20190410134517.63896-2-bruce.richardson@intel.com>
 <f7ttvf6ezk5.fsf@dhcp-25.97.bos.redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <f7ttvf6ezk5.fsf@dhcp-25.97.bos.redhat.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
Subject: Re: [dpdk-dev] [PATCH 1/2] acl: remove use of weak functions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 10 Apr 2019 14:02:37 -0000

On Wed, Apr 10, 2019 at 09:54:02AM -0400, Aaron Conole wrote:
> Bruce Richardson <bruce.richardson@intel.com> writes:
> 
> > Weak functions don't work well with static libraries and require the
> > use of "whole-archive" flag to ensure that the correct function is used
> > when linking. Since the weak functions are only used as placeholders
> > within this library alone, we can replace them with non-weak functions
> > using preprocessor ifdefs.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> ---
> > lib/librte_acl/meson.build |  7 ++++++- lib/librte_acl/rte_acl.c   | 18
> > ++++++++++++++---- mk/rte.app.mk              |  3 --- 3 files changed,
> > 20 insertions(+), 8 deletions(-)
> >
> > diff --git a/lib/librte_acl/meson.build b/lib/librte_acl/meson.build
> > index 2207dbafe..98ece7d85 100644 --- a/lib/librte_acl/meson.build +++
> > b/lib/librte_acl/meson.build @@ -6,7 +6,7 @@ sources =
> > files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c', 'rte_acl.c',
> > 'tb_mem.c') headers = files('rte_acl.h', 'rte_acl_osdep.h')
> >  
> > -if arch_subdir == 'x86' +if dpdk_conf.has('RTE_ARCH_X86') sources +=
> > files('acl_run_sse.c')
> >  
> >  	# compile AVX2 version if either: @@ -28,4 +28,9 @@ if arch_subdir
> >  	== 'x86' cflags += '-DCC_AVX2_SUPPORT' endif
> >  
> > +elif dpdk_conf.has('RTE_ARCH_ARM') or dpdk_conf.has('RTE_ARCH_ARM64')
> > +	cflags += '-flax-vector-conversions' +	sources +=
> > files('acl_run_neon.c')
> 
> This will also need -Wno-uninitialized (otherwise it will generate
> warnings about the search_neon_4 and search_neon_8 functions).
> 
> But I don't like papering over these conversions.  I'd prefer instead the
> patches I posted at:
> 
> http://mails.dpdk.org/archives/dev/2019-April/129540.html and
> http://mails.dpdk.org/archives/dev/2019-April/129541.html
> 
> Are you opposed to merging those?
> 
Nope, not in the least. I'm happy enough to rework this patch on top of
those - I'd just had forgotten about them in my rush to get a potential
solution out here.  I did these up quickly to show how easy it is to remove
the need for the weak functions and the subsequent linker "--whole-archive"
flag.

/Bruce

PS: I see your patch 2 does not include the Wno-uninitialized flag, is it
not needed in your patch, or just an oversight?

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 154DBA0096
	for <public@inbox.dpdk.org>; Wed, 10 Apr 2019 16:02:42 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 2E9A51B185;
	Wed, 10 Apr 2019 16:02:38 +0200 (CEST)
Received: from mga07.intel.com (mga07.intel.com [134.134.136.100])
 by dpdk.org (Postfix) with ESMTP id B33CE1B148
 for <dev@dpdk.org>; Wed, 10 Apr 2019 16:02:36 +0200 (CEST)
X-Amp-Result: UNSCANNABLE
X-Amp-File-Uploaded: False
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 10 Apr 2019 07:02:35 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="222234492"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.35])
 by orsmga001.jf.intel.com with SMTP; 10 Apr 2019 07:02:33 -0700
Received: by  (sSMTP sendmail emulation); Wed, 10 Apr 2019 15:02:32 +0100
Date: Wed, 10 Apr 2019 15:02:32 +0100
From: Bruce Richardson <bruce.richardson@intel.com>
To: Aaron Conole <aconole@redhat.com>
Cc: konstantin.ananyev@intel.com, dev@dpdk.org
Message-ID: <20190410140232.GD718@bricha3-MOBL.ger.corp.intel.com>
References: <20190410134517.63896-1-bruce.richardson@intel.com>
 <20190410134517.63896-2-bruce.richardson@intel.com>
 <f7ttvf6ezk5.fsf@dhcp-25.97.bos.redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
In-Reply-To: <f7ttvf6ezk5.fsf@dhcp-25.97.bos.redhat.com>
User-Agent: Mutt/1.11.4 (2019-03-13)
Subject: Re: [dpdk-dev] [PATCH 1/2] acl: remove use of weak functions
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190410140232.vK0mHM26dgQNlANi7Q9hvg4IIO5MDeRFwvE8_iu9Gio@z>

On Wed, Apr 10, 2019 at 09:54:02AM -0400, Aaron Conole wrote:
> Bruce Richardson <bruce.richardson@intel.com> writes:
> 
> > Weak functions don't work well with static libraries and require the
> > use of "whole-archive" flag to ensure that the correct function is used
> > when linking. Since the weak functions are only used as placeholders
> > within this library alone, we can replace them with non-weak functions
> > using preprocessor ifdefs.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> ---
> > lib/librte_acl/meson.build |  7 ++++++- lib/librte_acl/rte_acl.c   | 18
> > ++++++++++++++---- mk/rte.app.mk              |  3 --- 3 files changed,
> > 20 insertions(+), 8 deletions(-)
> >
> > diff --git a/lib/librte_acl/meson.build b/lib/librte_acl/meson.build
> > index 2207dbafe..98ece7d85 100644 --- a/lib/librte_acl/meson.build +++
> > b/lib/librte_acl/meson.build @@ -6,7 +6,7 @@ sources =
> > files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c', 'rte_acl.c',
> > 'tb_mem.c') headers = files('rte_acl.h', 'rte_acl_osdep.h')
> >  
> > -if arch_subdir == 'x86' +if dpdk_conf.has('RTE_ARCH_X86') sources +=
> > files('acl_run_sse.c')
> >  
> >  	# compile AVX2 version if either: @@ -28,4 +28,9 @@ if arch_subdir
> >  	== 'x86' cflags += '-DCC_AVX2_SUPPORT' endif
> >  
> > +elif dpdk_conf.has('RTE_ARCH_ARM') or dpdk_conf.has('RTE_ARCH_ARM64')
> > +	cflags += '-flax-vector-conversions' +	sources +=
> > files('acl_run_neon.c')
> 
> This will also need -Wno-uninitialized (otherwise it will generate
> warnings about the search_neon_4 and search_neon_8 functions).
> 
> But I don't like papering over these conversions.  I'd prefer instead the
> patches I posted at:
> 
> http://mails.dpdk.org/archives/dev/2019-April/129540.html and
> http://mails.dpdk.org/archives/dev/2019-April/129541.html
> 
> Are you opposed to merging those?
> 
Nope, not in the least. I'm happy enough to rework this patch on top of
those - I'd just had forgotten about them in my rush to get a potential
solution out here.  I did these up quickly to show how easy it is to remove
the need for the weak functions and the subsequent linker "--whole-archive"
flag.

/Bruce

PS: I see your patch 2 does not include the Wno-uninitialized flag, is it
not needed in your patch, or just an oversight?