From patchwork Mon Feb 10 10:32:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 65688 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C33A0A052F; Mon, 10 Feb 2020 11:32:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 36EB51BF80; Mon, 10 Feb 2020 11:32:32 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id A86371BF80 for ; Mon, 10 Feb 2020 11:32:30 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 56E7522025; Mon, 10 Feb 2020 05:32:30 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Feb 2020 05:32:30 -0500 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=f9lHOsLFxz GgDBHHqKRwfCUihBCx3bDE1txcfXFqya8=; b=J3nLMM+TlGElnMDBaarbfWTFVy sw3avrpFEbRyuGfgnriUDmF/DvTqxf/AgKtfY5TupLOv+IkG36QLqbc66VbZmq5x Cpzjs/5hiUU4RBMxZdhAl1wNQ9i0SaUcxALrZYKwdJWmF6y0nAvQJ1ese2cutzFK liBhJJZM1ZY27w/LE= 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=f9lHOsLFxzGgDBHHqKRwfCUihBCx3bDE1txcfXFqya8=; b=B+rt/IOI wbd5FFIbwqR9Lx3eHkKNe+IEIBmpguL9APnwrpRXJ8N2wtrHoaajHvF8jSGr/n+y XEZPTZjGTpIqJbVROSFkpfxpdZVr5ITyRRkwcwDgx2y71tCYDcBKqZ646P7dcnU6 00wXGXPV/jjbH0+Ntog3Mh41KbGiTyokjEKD5pNTYv/ACJdMpymArw1+as8WBvLj KcZIL9UPhTsEydlcPwLBo/Q+EEXo5xn54f65WaJ5eifvuOUbhVZ+aZGUbdohMeCP zPgY1YWLjaTgOaNNScjku5zGzUICP7YdLlI8t1k3x0Jzi2/gncQ4r211d8FfquNx WCDltfUadAJm6Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedriedugdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgepudenucfrrghr 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 9C6E73280063; Mon, 10 Feb 2020 05:32:29 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Date: Mon, 10 Feb 2020 11:32:15 +0100 Message-Id: <20200210103216.1168439-3-thomas@monjalon.net> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210103216.1168439-1-thomas@monjalon.net> References: <20200210103216.1168439-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 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. Signed-off-by: Thomas Monjalon --- 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 f96506c27a..6110cf49de 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -16,6 +16,9 @@ int mlx5_common_logtype; +#ifdef MLX5_GLUE +const struct mlx5_glue *mlx5_glue = NULL; +#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_ */