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 inbox.dpdk.org (Postfix) with ESMTP id 2DB7FA3160
	for <public@inbox.dpdk.org>; Thu, 10 Oct 2019 00:59:13 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id EBEDE1E551;
	Thu, 10 Oct 2019 00:59:12 +0200 (CEST)
Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com
 [209.85.215.193]) by dpdk.org (Postfix) with ESMTP id E57121E54B
 for <dev@dpdk.org>; Thu, 10 Oct 2019 00:59:10 +0200 (CEST)
Received: by mail-pg1-f193.google.com with SMTP id y35so2388611pgl.1
 for <dev@dpdk.org>; Wed, 09 Oct 2019 15:59:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=fC6lUh671ciEQDFtGDFSP/Ys59Dto1a2FyHkDQGRRns=;
 b=WL1vltIvBffyPHr1qHHB23EjTuT/8SxmeEILSPT+Hh7opXTpJt4NLUzh4/iU26gdJv
 lWxRPe2De+M3Mo8soX8jQKOLwtZbsE+yMb6ATbQxtsmq43R0AJFFKHXCrKqM11RefKLK
 /gsA71mAQBOHogiK6NrGiFubH8/JHCQK0W5arWtNqU9Hr2FaMNc64P7twdZPT3vYL8B4
 1LcU0siJUyO7PKjd0PsC4cGkbCq1YV6hjgmCcYX5W4DN6hl/ydBLL1BKumd7I70drOxc
 V+r1Q551pnSMY8BOnfveooGjmxFmB6UJC8Cztbyh/NDzka+yAcd4elQqb4mSs+eigDZk
 Oy/A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=fC6lUh671ciEQDFtGDFSP/Ys59Dto1a2FyHkDQGRRns=;
 b=DAs1/F1ZPaTUUbwkhm+/Fcm8ip51nRVBDz/1S2fSh+1hHEyTSdmIcVK81qd+wrJ3eE
 RJA3dA9aPUqkI6b7yANWaPafxnzj7ZpFJ+yrDMrAkiS1iCXqXGpBLIx24jsPulurarw3
 DL9q7ywaSKI8tNOmbZzfm9qkEVBz9f/jQZZe8A94acLh051eH+HRm34vfVsChcUeFkgk
 I46Qi1Nkug/etqdifPZCjabyRpUa1g2/MKkdtM4FXWqGw7e1neXAsCJxehZfJP8fJW6m
 rptLdnwWMxABVRtvzS53mx+J3FkIA137h5iG622I3ggArig5ToiCzcRPJxs0rTLUBdmq
 8//Q==
X-Gm-Message-State: APjAAAXNe3YtE/pPC2rYeJi2tqARWL5Kny62WkDTsLbyc5hKCdFtFeT5
 G/HNkgGRJC0vkUr/CCX05EbNcQ==
X-Google-Smtp-Source: APXvYqx3++bLjG77/LXUuSLm3DS7AwWhDqMhgCooZxVthcHO3Q9pTK9zyD0RscAP1aq12tSxeNspfA==
X-Received: by 2002:a17:90a:195d:: with SMTP id
 29mr7278364pjh.130.1570661949995; 
 Wed, 09 Oct 2019 15:59:09 -0700 (PDT)
Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id r24sm3670498pgo.58.2019.10.09.15.59.09
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 09 Oct 2019 15:59:09 -0700 (PDT)
Date: Wed, 9 Oct 2019 15:59:03 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, Andrzej Ostruszka <amo@semihalf.com>, Thomas Monjalon
 <thomas@monjalon.net>, Ray Kinsella <mdr@ashroe.eu>, Neil Horman
 <nhorman@tuxdriver.com>
Message-ID: <20191009155903.62c55d42@hermes.lan>
In-Reply-To: <20190927194932.22197-1-bruce.richardson@intel.com>
References: <20190927194932.22197-1-bruce.richardson@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH 0/2] Improve function versioning meson support
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>

On Fri, 27 Sep 2019 20:49:30 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:

> Adding support for LTO has exposed some issues with how the functions
> versioning was supported by meson, which was always set to build both
> shared and static libraries.
> 
> For plain C code, so long as the -fPIC compiler flag was passed, the
> output is identical whether or not the code is to be included in a
> static library or a dynamic one. Unfortunately, when using function
> versioning that no longer held as different macros were used for the
> versioned functions depending on which type of build it was. This means
> that any files that use versioning need to be built twice, with
> different defines in each case.
> 
> While the trivial solution here is just to rebuild everything twice,
> that involves a lot of unnecessary work when building DPDK. A better
> option is to identify those files or components which need multiple
> builds and rebuild only those. To do this, we add a new meson.build
> setting for libraries "use_function_versioning" and when that is set, we
> rebuild all source files twice, initially for static library and then
> with -DRTE_BUILD_SHARED_LIB for the shared library.
> 
> If the flag is not set, then the static versioning setting only is used,
> which could lead to the build succeeding but later causing problems. To
> avoid that, we add a new define which must be set when the versioning
> header is included. This addition while solving 1 problem raises 2
> other, more minor problems:
> * what to do with make builds? since make only builds one library type,
>   we can just always define the new value.
> * what about files that include rte_compat.h for the macro for
>   "experimental"? To solve this, we can split compat.h in two, since the
>   versioning macro should be internal only to DPDK (as no public header
>   should expose anything but the latest APIs), while the experimental
>   macros are primarily for public use.
> 
> Bruce Richardson (2):
>   eal: split compat header file
>   build: support building ABI versioned files twice
> 
>  config/common_base                            |  1 +
>  config/rte_config.h                           |  3 ---
>  doc/api/doxy-api-index.md                     |  3 ++-
>  doc/guides/contributing/coding_style.rst      |  7 ++++++
>  doc/guides/contributing/versioning.rst        |  4 ++--
>  lib/librte_distributor/meson.build            |  1 +
>  lib/librte_distributor/rte_distributor.c      |  2 +-
>  lib/librte_distributor/rte_distributor_v20.c  |  2 +-
>  lib/librte_eal/common/Makefile                |  1 +
>  ...rte_compat.h => rte_function_versioning.h} | 23 ++++++-------------
>  lib/librte_lpm/meson.build                    |  1 +
>  lib/librte_lpm/rte_lpm.c                      |  1 +
>  lib/librte_lpm/rte_lpm.h                      |  1 -
>  lib/librte_lpm/rte_lpm6.c                     |  1 +
>  lib/librte_timer/meson.build                  |  1 +
>  lib/librte_timer/rte_timer.c                  |  2 +-
>  lib/meson.build                               | 16 ++++++++++---
>  17 files changed, 41 insertions(+), 29 deletions(-)
>  rename lib/librte_eal/common/include/{rte_compat.h => rte_function_versioning.h} (89%)
> 

Looks fine.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>