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 86FBFA052F; Mon, 10 Feb 2020 11:32:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 042CC1BF9E; Mon, 10 Feb 2020 11:32:35 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 245832BD5 for ; Mon, 10 Feb 2020 11:32:33 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C57E621C4E; Mon, 10 Feb 2020 05:32:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 10 Feb 2020 05:32:32 -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=6O7TbM4LSu fHGgME1DtddBi28yoK1IJKU+ZTORYGufQ=; b=kGmK8q6zi09LOZzqHu6jHbo7Ae wOmnodshhrWZwQvPnkJeLeej3Db4Gf2xJ0WNwiRKInxiQfy5SHfYzOI0R/b9xvm5 wxSTV+6Jto1VXiCQCvcQbqzPqQ4exAt6lWfci6nmQf5c6Tif36fc6JIHBapC5de5 W9GBVCAOsFsEZ9LgM= 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=6O7TbM4LSufHGgME1DtddBi28yoK1IJKU+ZTORYGufQ=; b=E1HGAB4O KzCdCqLjQv1YuJA/O26PzfErj8ZTnU2gFgbLBkNkgW1c2uvdqHPyOvp1NpzcOSev 9OPLTTROMBQC9sW+R+T4v+SPoc5stevD3cDcn8OCOg6vNqCPoo7kcdEEqgO94ITV 6vWzAgcDIFNj46xlDun7Gl1IdF6Y4YyekFhwzm+6N+XFf8XfN4LvVFDU8z4T/ewk kQMREadzqZOvBHKXmXpA68lr6agUBcDGmF4zfzkL33b0RgFYLMg2CzuBSFqU0qGK ZfghiQn/D7T5T2i3S7B77OSBRRGz/w7eN/Jj8qD0K/QryJSQXOGaUR5fvpDQvTPc WA6z2WtVubyiRg== 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 29FDA328005D; Mon, 10 Feb 2020 05:32:32 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: Matan Azrad , Shahaf Shuler Date: Mon, 10 Feb 2020 11:32:16 +0100 Message-Id: <20200210103216.1168439-4-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 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 3/3] net/mlx4: 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 mlx4_glue is referencing the glue functions struct and is set after calling dlopen. If compiling with -fno-common (default in GCC 10), the variables must be declared as extern to avoid multiple re-definitions. In case the glue layer is split in glue library, the variable mlx4_glue needs to have its own storage for the rest of the PMD. Signed-off-by: Thomas Monjalon --- drivers/net/mlx4/mlx4.c | 4 ++++ drivers/net/mlx4/mlx4_glue.h | 2 +- drivers/net/mlx4/mlx4_rxtx.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index a1dd658176..49e721df5f 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -47,6 +47,10 @@ #include "mlx4_rxtx.h" #include "mlx4_utils.h" +#ifdef MLX4_GLUE +const struct mlx4_glue *mlx4_glue = NULL; +#endif + static const char *MZ_MLX4_PMD_SHARED_DATA = "mlx4_pmd_shared_data"; /* Shared memory between primary and secondary processes. */ diff --git a/drivers/net/mlx4/mlx4_glue.h b/drivers/net/mlx4/mlx4_glue.h index 668ca86700..5d9e985495 100644 --- a/drivers/net/mlx4/mlx4_glue.h +++ b/drivers/net/mlx4/mlx4_glue.h @@ -84,6 +84,6 @@ struct mlx4_glue { void *attr); }; -const struct mlx4_glue *mlx4_glue; +extern const struct mlx4_glue *mlx4_glue; #endif /* MLX4_GLUE_H_ */ diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h index 8baf33fa94..9de6c59411 100644 --- a/drivers/net/mlx4/mlx4_rxtx.h +++ b/drivers/net/mlx4/mlx4_rxtx.h @@ -124,7 +124,7 @@ struct txq { /* mlx4_rxq.c */ -uint8_t mlx4_rss_hash_key_default[MLX4_RSS_HASH_KEY_SIZE]; +extern uint8_t mlx4_rss_hash_key_default[MLX4_RSS_HASH_KEY_SIZE]; int mlx4_rss_init(struct mlx4_priv *priv); void mlx4_rss_deinit(struct mlx4_priv *priv); struct mlx4_rss *mlx4_rss_get(struct mlx4_priv *priv, uint64_t fields, -- 2.25.0