[dpdk-stable] [PATCH 19.11] net/mlx5: fix build with separate glue lib for dlopen
Thomas Monjalon
thomas at monjalon.net
Sat Jun 6 12:08:56 CEST 2020
If building with option RTE_IBVERBS_LINK_DLOPEN (make)
or ibverbs_link=dlopen (meson), the glue is a separate library
which can be dlopen.
In such case, the object mlx5_glue must be allocated in two places:
one in the glue, and one outside of the glue to be assigned when
loading the glue with dlopen/dlsym.
When backporting the allocation split for gcc 10, both allocations
were made inside the glue. As a consequence, the symbol is undefined
outside of the glue:
drivers/net/mlx5/mlx5.c: undefined reference to 'mlx5_glue'
The second allocation is restored outside of the glue, in mlx5.c.
Fixes: b3e01cd3e46f ("common/mlx5: fix build with -fno-common")
Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
drivers/net/mlx5/mlx5.c | 4 ++++
drivers/net/mlx5/mlx5_glue.c | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 9161114978..8879df317d 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -187,6 +187,10 @@ struct mlx5_dev_spawn_data {
struct rte_pci_device *pci_dev; /**< Backend PCI device. */
};
+#ifdef MLX5_GLUE
+const struct mlx5_glue *mlx5_glue;
+#endif
+
static LIST_HEAD(, mlx5_ibv_shared) mlx5_ibv_list = LIST_HEAD_INITIALIZER();
static pthread_mutex_t mlx5_ibv_list_mutex = PTHREAD_MUTEX_INITIALIZER;
diff --git a/drivers/net/mlx5/mlx5_glue.c b/drivers/net/mlx5/mlx5_glue.c
index c2dd0392d0..44f63116a8 100644
--- a/drivers/net/mlx5/mlx5_glue.c
+++ b/drivers/net/mlx5/mlx5_glue.c
@@ -30,10 +30,6 @@
#include "mlx5_autoconf.h"
#include "mlx5_glue.h"
-#ifdef MLX5_GLUE
-const struct mlx5_glue *mlx5_glue;
-#endif
-
static int
mlx5_glue_fork_init(void)
{
--
2.26.2
More information about the stable
mailing list