* Re: [dpdk-stable] [dpdk-dev] [PATCH 0/3] mlx: fix build with -fno-common (gcc 10) [not found] ` <AM0PR0502MB401926F72A8C41B49ED91296D2F60@AM0PR0502MB4019.eurprd05.prod.outlook.com> @ 2020-04-07 0:19 ` Thomas Monjalon 0 siblings, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2020-04-07 0:19 UTC (permalink / raw) To: Matan Azrad; +Cc: dev, stable 17/03/2020 09:34, Matan Azrad: > From: Thomas Monjalon > > In GCC 10, -fno-common will be the default. > > There are 2 ways of solving issues: > > - add -fcommon > > - stop allocating variables in .h files > > > > In this patchset, the variables are declared extern, because it is cleaner > > anyway. > > Series-acked-by: Matan Azrad <matan@mellanox.com> > > > Thomas Monjalon (3): > > common/mlx5: split glue initialization > > common/mlx5: fix build with -fno-common > > net/mlx4: fix build with -fno-common It seems these patches are also fixing usage of glue dlopen with PMD as shared library. We should add Cc: stable@dpdk.org and identify a root cause. ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20200407230647.59478-1-thomas@monjalon.net>]
* [dpdk-stable] [PATCH v2 2/3] common/mlx5: fix build with -fno-common [not found] ` <20200407230647.59478-1-thomas@monjalon.net> @ 2020-04-07 23:06 ` Thomas Monjalon 2020-04-07 23:06 ` [dpdk-stable] [PATCH v2 3/3] net/mlx4: " Thomas Monjalon 1 sibling, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2020-04-07 23:06 UTC (permalink / raw) To: dev; +Cc: stable, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko 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 <thomas@monjalon.net> Acked-by: Matan Azrad <matan@mellanox.com> --- 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-stable] [PATCH v2 3/3] net/mlx4: fix build with -fno-common [not found] ` <20200407230647.59478-1-thomas@monjalon.net> 2020-04-07 23:06 ` [dpdk-stable] [PATCH v2 2/3] common/mlx5: fix build with -fno-common Thomas Monjalon @ 2020-04-07 23:06 ` Thomas Monjalon 1 sibling, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2020-04-07 23:06 UTC (permalink / raw) To: dev; +Cc: stable, Matan Azrad, Shahaf Shuler 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. Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Matan Azrad <matan@mellanox.com> --- 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 339a4d3ab6..ee15f28dff 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -49,6 +49,10 @@ #include "mlx4_rxtx.h" #include "mlx4_utils.h" +#ifdef MLX4_GLUE +const struct mlx4_glue *mlx4_glue; +#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.26.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20200408000900.61896-1-thomas@monjalon.net>]
* [dpdk-stable] [PATCH v3 2/3] common/mlx5: fix build with -fno-common [not found] ` <20200408000900.61896-1-thomas@monjalon.net> @ 2020-04-08 0:08 ` Thomas Monjalon 2020-04-08 0:09 ` [dpdk-stable] [PATCH v3 3/3] net/mlx4: " Thomas Monjalon 1 sibling, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2020-04-08 0:08 UTC (permalink / raw) To: dev; +Cc: stable, Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko 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 <thomas@monjalon.net> Acked-by: Matan Azrad <matan@mellanox.com> --- 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-stable] [PATCH v3 3/3] net/mlx4: fix build with -fno-common [not found] ` <20200408000900.61896-1-thomas@monjalon.net> 2020-04-08 0:08 ` [dpdk-stable] [PATCH v3 2/3] common/mlx5: " Thomas Monjalon @ 2020-04-08 0:09 ` Thomas Monjalon 1 sibling, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2020-04-08 0:09 UTC (permalink / raw) To: dev; +Cc: stable, Matan Azrad, Shahaf Shuler 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. Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Matan Azrad <matan@mellanox.com> --- 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 8e298788af..5d7202720b 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -49,6 +49,10 @@ #include "mlx4_rxtx.h" #include "mlx4_utils.h" +#ifdef MLX4_GLUE +const struct mlx4_glue *mlx4_glue; +#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.26.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-08 0:09 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20200210103216.1168439-1-thomas@monjalon.net> [not found] ` <AM0PR0502MB401926F72A8C41B49ED91296D2F60@AM0PR0502MB4019.eurprd05.prod.outlook.com> 2020-04-07 0:19 ` [dpdk-stable] [dpdk-dev] [PATCH 0/3] mlx: fix build with -fno-common (gcc 10) Thomas Monjalon [not found] ` <20200407230647.59478-1-thomas@monjalon.net> 2020-04-07 23:06 ` [dpdk-stable] [PATCH v2 2/3] common/mlx5: fix build with -fno-common Thomas Monjalon 2020-04-07 23:06 ` [dpdk-stable] [PATCH v2 3/3] net/mlx4: " Thomas Monjalon [not found] ` <20200408000900.61896-1-thomas@monjalon.net> 2020-04-08 0:08 ` [dpdk-stable] [PATCH v3 2/3] common/mlx5: " Thomas Monjalon 2020-04-08 0:09 ` [dpdk-stable] [PATCH v3 3/3] net/mlx4: " Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).