From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: [PATCH v3 6/6] mk: prevent overlinking in applications Date: Fri, 10 Jun 2016 19:32:30 +0100 Message-ID: <1465583550-21020-7-git-send-email-ferruh.yigit@intel.com> References: <1465564749-1405-1-git-send-email-thomas.monjalon@6wind.com> <1465583550-21020-1-git-send-email-ferruh.yigit@intel.com> Cc: Thomas Monjalon , Panu Matilainen , Christian Ehrhardt , Ferruh Yigit To: dev@dpdk.org Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id E645E2BAD for ; Fri, 10 Jun 2016 20:33:51 +0200 (CEST) In-Reply-To: <1465583550-21020-1-git-send-email-ferruh.yigit@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace --no-as-needed linker flag with --as-needed flag, which will only link libraries directly called by application. It can be achieved now that the libraries dependencies are handled properly. Signed-off-by: Ferruh Yigit Signed-off-by: Thomas Monjalon --- mk/exec-env/linuxapp/rte.vars.mk | 3 --- mk/rte.app.mk | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mk/exec-env/linuxapp/rte.vars.mk b/mk/exec-env/linuxapp/rte.vars.mk index d51bd17..a8a1ee4 100644 --- a/mk/exec-env/linuxapp/rte.vars.mk +++ b/mk/exec-env/linuxapp/rte.vars.mk @@ -45,9 +45,6 @@ else EXECENV_CFLAGS = -pthread endif -# Workaround lack of DT_NEEDED entry -EXECENV_LDFLAGS = --no-as-needed - EXECENV_LDLIBS = EXECENV_ASFLAGS = diff --git a/mk/rte.app.mk b/mk/rte.app.mk index f60e5bf..aa794bc 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -50,6 +50,14 @@ ifeq ($(NO_LDSCRIPT),) LDSCRIPT = $(RTE_LDSCRIPT) endif +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +# Workaround to eal <-> mempool cyclic dependency +_LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += -lrte_mempool +endif + +# Link only the libraries used in the application +_LDLIBS-y += --as-needed + # default path for libs _LDLIBS-y += -L$(RTE_SDK_BIN)/lib -- 2.5.5