[dpdk-dev] [PATCH 1/2] mk: prevent overlinking in applications
Ferruh Yigit
ferruh.yigit at intel.com
Fri May 27 18:48:05 CEST 2016
Replace --no-as-needed linker flag with --as-needed flag, which will
only link libraries directly called by application. This requires inter
library dependencies resolved correctly.
Not linking all libraries cause a compile error for lpcap and possible
to have other similar compiler errors, so increasing the scope of
--start-group argument.
cmdline_test application causes compile error because of cyclic
dependency between librte_eal <-> librte_mempool. A workaround added to
cmdline_test for compile error.
Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
This patch is on top of patch:
http://dpdk.org/dev/patchwork/patch/12987/
---
app/cmdline_test/Makefile | 1 +
mk/exec-env/linuxapp/rte.vars.mk | 2 +-
mk/rte.app.mk | 3 +--
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/cmdline_test/Makefile b/app/cmdline_test/Makefile
index c6169f5..5b7a2a2 100644
--- a/app/cmdline_test/Makefile
+++ b/app/cmdline_test/Makefile
@@ -46,6 +46,7 @@ SRCS-y += commands.c
CFLAGS += -O3
CFLAGS += $(WERROR_FLAGS)
+LDFLAGS += -no-as-needed
# this application needs libraries first
DEPDIRS-y += lib drivers
diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk
index d51bd17..10d37d5 100644
--- a/mk/exec-env/linuxapp/rte.vars.mk
+++ b/mk/exec-env/linuxapp/rte.vars.mk
@@ -46,7 +46,7 @@ EXECENV_CFLAGS = -pthread
endif
# Workaround lack of DT_NEEDED entry
-EXECENV_LDFLAGS = --no-as-needed
+EXECENV_LDFLAGS = --as-needed
EXECENV_LDLIBS =
EXECENV_ASFLAGS =
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index b84b56d..e12226c 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -58,6 +58,7 @@ _LDLIBS-y += -L$(RTE_SDK_BIN)/lib
#
_LDLIBS-y += --whole-archive
+_LDLIBS-y += --start-group
_LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor
_LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder
@@ -111,8 +112,6 @@ _LDLIBS-y += -lcrypto
endif
endif # !CONFIG_RTE_BUILD_SHARED_LIBS
-_LDLIBS-y += --start-group
-
_LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS) += -lrte_kvargs
_LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF) += -lrte_mbuf
_LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag
--
2.5.5
More information about the dev
mailing list