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 16A77A058B for ; Wed, 8 Apr 2020 02:09:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE35D1BFE6; Wed, 8 Apr 2020 02:09:14 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 5EB0B1BF59; Wed, 8 Apr 2020 02:09:13 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 131955C01AE; Tue, 7 Apr 2020 20:09:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Tue, 07 Apr 2020 20:09:13 -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=PEGC7hqX8o A9B8OgU/eVIuQY/RKm4BShPCl7bk+fK3U=; b=Jjhrmv+6gXFnZ0+rtby8zHkmdy 0mdhn9pZcKQjJAqKuJ+PUDx9QCS1mnDq5MLH+amnDRfH0wh/H3imUX+/K8R2nLdL DtFiRuuhHBkAPAFvt9HyBRJcbn0Y8i4IO/uYOq0ndo9mV0HW8aIOaSGc5lA9PoBW R1WgM41r0B0HIr+ls= 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=PEGC7hqX8oA9B8OgU/eVIuQY/RKm4BShPCl7bk+fK3U=; b=eKzSQr+W q1S0KoLXDSGdCrKehWIiiUtsYt3eRcQNFtFoeDaKPfFxvqqiXI6doJjT5OFa9O+1 B0u9/sS0D1/who8bRcme7Pk0AlLg3XsNDi7R+DtVadwReMuwVtrh7tf/Ezrr3QzD Z2ca4qqE2jreiS43AJUbrilpoB3sTYykYPl3I0uUJ2HAPAI+4mg4KwcXcS/KUQv9 hOrak7lflONSe22m+V1Z5+d0vHA9VBXzTaPh6udCDpVb7v7RJ/yxqQxIYJiQ3iL5 zI6jOTAxEsiucA/3nH1xwz26sAjTSCfyHx7igRpzZj0QSptLXWo8aeLvbmIVEZDN KnpjiaLjvCIwCw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeigdefudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr 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 27AE4306D631; Tue, 7 Apr 2020 20:09:12 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: stable@dpdk.org, Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Wed, 8 Apr 2020 02:08:59 +0200 Message-Id: <20200408000900.61896-3-thomas@monjalon.net> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200408000900.61896-1-thomas@monjalon.net> References: <20200210103216.1168439-1-thomas@monjalon.net> <20200408000900.61896-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v3 2/3] common/mlx5: fix build with -fno-common X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 d8c01a5d14..42610459f7 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