[dpdk-dev] [PATCH v2 4/4] mk: update LDLIBS for app building
Sergio Gonzalez Monroy
sergio.gonzalez.monroy at intel.com
Thu Mar 12 17:28:01 CET 2015
Given the circular dependencies between eal, malloc, mempool and ring
libraries and that eal does not have proper DT_NEEDED entries, we work
around it by forcing linking against mentioned libraries by preceding
them with --no-as-needed flag when building shared libraries.
This patch also does:
- Set --start-group/--end-group and --whole-archive/--no-whole-archive
flags only when linking against static DPDK libs.
- Set --as-needed for all libraries but eal, malloc, mempool and
ring when linking against shared DPDK libs.
- Link against EXECENV_LIBS always with --as-needed flag.
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy at intel.com>
---
lib/librte_jobstats/Makefile | 2 ++
lib/librte_pmd_fm10k/Makefile | 2 ++
lib/librte_pmd_mlx4/Makefile | 2 ++
lib/librte_pmd_null/Makefile | 2 ++
lib/librte_reorder/Makefile | 2 ++
mk/rte.app.mk | 57 +++++++++++++++++++++++--------------------
6 files changed, 40 insertions(+), 27 deletions(-)
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 136a448..04589d4 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -41,6 +41,8 @@ EXPORT_MAP := rte_jobstats_version.map
LIBABIVER := 1
+LDLIBS += -lrte_eal
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_JOBSTATS) := rte_jobstats.c
diff --git a/lib/librte_pmd_fm10k/Makefile b/lib/librte_pmd_fm10k/Makefile
index 998bf23..618235a 100644
--- a/lib/librte_pmd_fm10k/Makefile
+++ b/lib/librte_pmd_fm10k/Makefile
@@ -79,6 +79,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER))
VPATH += $(RTE_SDK)/lib/librte_pmd_fm10k/base
+LDLIBS += -lrte_eal -lrte_malloc -lethdev
+
#
# all source are stored in SRCS-y
#
diff --git a/lib/librte_pmd_mlx4/Makefile b/lib/librte_pmd_mlx4/Makefile
index 6666813..9193f05 100644
--- a/lib/librte_pmd_mlx4/Makefile
+++ b/lib/librte_pmd_mlx4/Makefile
@@ -58,6 +58,8 @@ CFLAGS += -Wno-error=cast-qual
EXPORT_MAP := rte_pmd_mlx4_version.map
LIBABIVER := 1
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_malloc -lethdev -libverbs
+
# DEBUG which is usually provided on the command-line may enable
# CONFIG_RTE_LIBRTE_MLX4_DEBUG.
ifeq ($(DEBUG),1)
diff --git a/lib/librte_pmd_null/Makefile b/lib/librte_pmd_null/Makefile
index 6472015..c9bf1fd 100644
--- a/lib/librte_pmd_null/Makefile
+++ b/lib/librte_pmd_null/Makefile
@@ -43,6 +43,8 @@ EXPORT_MAP := rte_pmd_null_version.map
LIBABIVER := 1
+LDLIBS += -lrte_eal -lrte_malloc -lethdev -lrte_kvargs
+
#
# all source are stored in SRCS-y
#
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 0c01de1..2c8f774 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -41,6 +41,8 @@ EXPORT_MAP := rte_reorder_version.map
LIBABIVER := 1
+LDLIBS += -lrte_eal -lrte_malloc
+
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_REORDER) := rte_reorder.c
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index e2baa49..7e225fd 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -59,7 +59,30 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
#
ifeq ($(NO_AUTOLIBS),)
-LDLIBS += --whole-archive
+LDLIBS += --no-as-needed
+ifneq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+LDLIBS += --start-group
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
+LDLIBS += -lrte_eal
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
+LDLIBS += -lrte_malloc
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
+LDLIBS += -lrte_mempool
+endif
+
+ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
+LDLIBS += -lrte_ring
+endif
+
+ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)
+LDLIBS += --as-needed
+endif
ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
LDLIBS += -lrte_distributor
@@ -127,15 +150,12 @@ LDLIBS += -lm
LDLIBS += -lrt
endif
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
LDLIBS += -lpcap
endif
ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
+LDLIBS += -lrte_vhost
LDLIBS += -lfuse
endif
@@ -143,8 +163,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
LDLIBS += -libverbs
endif
-LDLIBS += --start-group
-
ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
LDLIBS += -lrte_kvargs
endif
@@ -161,22 +179,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
LDLIBS += -lethdev
endif
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
LDLIBS += -lrte_cmdline
endif
@@ -196,6 +198,7 @@ endif
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
# plugins (link only if static libraries)
+LDLIBS += --whole-archive
ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
LDLIBS += -lrte_pmd_vmxnet3_uio
@@ -241,14 +244,14 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_AF_PACKET),y)
LDLIBS += -lrte_pmd_af_packet
endif
+LDLIBS += --no-whole-archive
+LDLIBS += --end-group
+LDLIBS += --as-needed
+
endif # plugins
LDLIBS += $(EXECENV_LDLIBS)
-LDLIBS += --end-group
-
-LDLIBS += --no-whole-archive
-
endif # ifeq ($(NO_AUTOLIBS),)
LDLIBS += $(CPU_LDLIBS)
--
1.9.3
More information about the dev
mailing list