From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 5/5] mk: update LDLIBS for app building
Date: Wed, 8 Apr 2015 16:07:25 +0100 [thread overview]
Message-ID: <1428505645-5578-6-git-send-email-sergio.gonzalez.monroy@intel.com> (raw)
In-Reply-To: <1428505645-5578-1-git-send-email-sergio.gonzalez.monroy@intel.com>
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@intel.com>
---
mk/rte.app.mk | 54 ++++++++++++++++++++++++++++++------------------------
1 file changed, 30 insertions(+), 24 deletions(-)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index e8630b6..2d6b2ca 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,7 +150,7 @@ LDLIBS += -lm
LDLIBS += -lrt
endif
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y)
LDLIBS += -lrte_vhost
endif
@@ -143,8 +166,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 +182,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 +201,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 +247,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
prev parent reply other threads:[~2015-04-08 15:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 15:07 [dpdk-dev] [PATCH v3 0/5] Enhance build process Sergio Gonzalez Monroy
2015-04-08 15:07 ` [dpdk-dev] [PATCH v3 1/5] mk: remove combined library and related options Sergio Gonzalez Monroy
2015-04-08 18:26 ` Stephen Hemminger
2015-04-09 8:33 ` Gonzalez Monroy, Sergio
2015-04-09 9:06 ` Avi Kivity
2015-04-09 9:42 ` Gonzalez Monroy, Sergio
2015-04-09 11:19 ` Neil Horman
2015-04-09 13:33 ` Thomas Monjalon
2015-04-09 13:47 ` Gonzalez Monroy, Sergio
2015-04-09 17:00 ` Avi Kivity
2015-04-09 20:34 ` Neil Horman
2015-04-13 9:52 ` Gonzalez Monroy, Sergio
2015-04-13 11:04 ` Thomas Monjalon
2015-04-13 11:23 ` Neil Horman
2015-04-08 15:07 ` [dpdk-dev] [PATCH v3 2/5] mk: always generate combined lib linker script Sergio Gonzalez Monroy
2015-04-08 15:07 ` [dpdk-dev] [PATCH v3 3/5] lib: set LDLIBS for each library Sergio Gonzalez Monroy
2015-04-08 15:07 ` [dpdk-dev] [PATCH v3 4/5] mk: use LDLIBS when linking shared libraries Sergio Gonzalez Monroy
2015-04-08 15:07 ` Sergio Gonzalez Monroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428505645-5578-6-git-send-email-sergio.gonzalez.monroy@intel.com \
--to=sergio.gonzalez.monroy@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).