From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A0BEDA0588; Wed, 8 Apr 2020 01:07:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5A04F1C036; Wed, 8 Apr 2020 01:06:57 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id EF6E41C027; Wed, 8 Apr 2020 01:06:55 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 66C7D5C0195; Tue, 7 Apr 2020 19:06:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Tue, 07 Apr 2020 19:06:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=58Fc2uelyj TWwxbhU9YPTsMx3chiT2bDY2aaMmKFBfY=; b=gB8dsWgBCmPnDGkPS6lF7wOuhY Oe+drG1F9fSsYxkHt8+ws84sOGkkb2N5cmc7q/WvJ+aDJGlhGDraAc2hf/eQOL6T hqX2R074/gGE4ipcEM7rxVwgERnxPudxvro+7sQavOgLobjGFT4kYLysC/MeiwKl fbpC7SfiqSqiYvc50= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=58Fc2uelyjTWwxbhU9YPTsMx3chiT2bDY2aaMmKFBfY=; b=jx/lKb5v mWElkDAu1CzRbW156FGTzLbfzZ266vcmHyDJRCU7Mn7kHwptUiZS0VbOmVyrcpNH 4UouunZEiKKvh0VM6DQZ0rJ7pYnW454d07GMGCzouTDhDVVqS4+fuZxn0wTQABYR Pv2SEiUurnnZPsBnlijZOgN696GkF9/QQqqJrjcYR8jpNChHkTRfgHKVjboJV6Sv z8ZUqX+QBsvvKUqDRcM9XvYt8MyQfoO5y1LA9CKcceXW7v0VpR4m++MLpttWflHM dF4A9BAS7CSdsUsfmflSMHcIuQu7mfSiTTciFKpmOgKEJ/4ALpTgJ8FKDWNIhUe+ S2noL6pbUVJxig== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeigddujecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepvdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 8A748306D621; Tue, 7 Apr 2020 19:06:54 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: stable@dpdk.org, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Wed, 8 Apr 2020 01:06:46 +0200 Message-Id: <20200407230647.59478-3-thomas@monjalon.net> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200407230647.59478-1-thomas@monjalon.net> References: <20200210103216.1168439-1-thomas@monjalon.net> <20200407230647.59478-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/3] common/mlx5: fix build with -fno-common X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The variable storages of the same name are merged together if compiled with -fcommon. This is the default. This default behaviour allows to declare a variable in a header file and share the variable in every .o binaries thanks to merge at link-time. In the case of dlopen linking of the glue library, the pointer mlx5_glue is referencing the glue functions struct and is set after calling dlopen. If compiling with -fno-common (default in GCC 10), the variable must be declared as extern to avoid multiple re-definitions. In case the glue layer is split in glue library, the variable mlx5_glue needs to have its own storage for the rest of the PMD. Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon Acked-by: Matan Azrad --- drivers/common/mlx5/mlx5_common.c | 3 +++ drivers/common/mlx5/mlx5_glue.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index 9a30e6e0aa..98a82c262f 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -18,6 +18,9 @@ int mlx5_common_logtype; +#ifdef MLX5_GLUE +const struct mlx5_glue *mlx5_glue; +#endif /** * Get PCI information by sysfs device path. diff --git a/drivers/common/mlx5/mlx5_glue.h b/drivers/common/mlx5/mlx5_glue.h index 6238b43946..29678623e4 100644 --- a/drivers/common/mlx5/mlx5_glue.h +++ b/drivers/common/mlx5/mlx5_glue.h @@ -300,6 +300,6 @@ struct mlx5_glue { size_t event_resp_len); }; -const struct mlx5_glue *mlx5_glue; +extern const struct mlx5_glue *mlx5_glue; #endif /* MLX5_GLUE_H_ */ -- 2.26.0