From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <fyigit@ecsmtp.ir.intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id E645E2BAD
 for <dev@dpdk.org>; Fri, 10 Jun 2016 20:33:51 +0200 (CEST)
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by orsmga101.jf.intel.com with ESMTP; 10 Jun 2016 11:33:51 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.26,451,1459839600"; d="scan'208";a="119738518"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by fmsmga004.fm.intel.com with ESMTP; 10 Jun 2016 11:33:49 -0700
Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com
 [10.237.217.46])
 by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id
 u5AIXmVE004601; Fri, 10 Jun 2016 19:33:48 +0100
Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1])
 by sivswdev02.ir.intel.com with ESMTP id u5AIXmTj022729;
 Fri, 10 Jun 2016 19:33:48 +0100
Received: (from fyigit@localhost)
 by sivswdev02.ir.intel.com with  id u5AIXmrJ022725;
 Fri, 10 Jun 2016 19:33:48 +0100
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>,
 Panu Matilainen <pmatilai@redhat.com>,
 Christian Ehrhardt <christian.ehrhardt@canonical.com>,
 Ferruh Yigit <ferruh.yigit@intel.com>
Date: Fri, 10 Jun 2016 19:32:30 +0100
Message-Id: <1465583550-21020-7-git-send-email-ferruh.yigit@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1465583550-21020-1-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>
Subject: [dpdk-dev] [PATCH v3 6/6] mk: prevent overlinking in applications
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 10 Jun 2016 18:33:52 -0000

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 <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 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