mk: fix static linkage of mlx dependency
authorBing Zhao <bingz@mellanox.com>
Wed, 29 Apr 2020 12:11:55 +0000 (20:11 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 6 May 2020 21:57:00 +0000 (23:57 +0200)
When building a target application with static linking mode via
makefiles and enable linking to ibverbs libs by setting
"CONFIG_RTE_IBVERBS_LINK_STATIC=y". The libibverbs.pc will be
chosen and all the libs listed in the file will be linked
by default. Some static lib archives may contain the same files
and common interfaces inside.
The "--no-whole-archive" needs to be enabled for the linker to
discard the useless symbols and resolve the symbols redefinition
error.

Fixes: 2c0dd7b69fb0 ("config: add static linkage of mlx dependency")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
mk/rte.app.mk

index 244e74d..db619c5 100644 (file)
@@ -209,7 +209,9 @@ ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y)
 _LDLIBS-y                                   += -ldl
 else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y)
 LIBS_IBVERBS_STATIC = $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh)
+_LDLIBS-y                                   += --no-whole-archive
 _LDLIBS-y                                   += $(LIBS_IBVERBS_STATIC)
+_LDLIBS-y                                   += --whole-archive
 else
 ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y)
 _LDLIBS-y                                   += -libverbs -lmlx5