From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <thomas.monjalon@6wind.com>
Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50])
 by dpdk.org (Postfix) with ESMTP id 3D7CD2BBC
 for <dev@dpdk.org>; Fri, 10 Jun 2016 15:19:22 +0200 (CEST)
Received: by mail-wm0-f50.google.com with SMTP id k184so3002242wme.1
 for <dev@dpdk.org>; Fri, 10 Jun 2016 06:19:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id:in-reply-to:references;
 bh=O0Aef9rPZBcNduFzl/XlBvv7llBan8Yd8HXfYtXsP6Q=;
 b=sGMm3wmJCsfQjz2C7CJ1wt8rqgdAG90b68WZXfexKhyWwr1EYFgMyR+G1tgbCKNiyy
 DQ4QTtsrhjF3rONvLz9qbRtybCK/4EwntyAsX7k29+eGdAEe+d/2v5hRED07Tfx34jRr
 v7KIklci1Q0aDP1qfhysRifbKxP53/ytStXm2bmMb6Gq5aihIOUc2Cpjb0PpS6mwPTbi
 6BQJp6VFZTFVi9MpveAa6mxtoKg4Y7v6YoL7hbwjdLgg7XwBSlSjIgRlAZn4WmaOE/+o
 TIPVrtVb8yMyNvtFHSwEC6Alui7f/h05h5Lt/xgdQVhfUMh6/hUFvYrzb1Z4+sZ8B/Nz
 5n6A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
 :references;
 bh=O0Aef9rPZBcNduFzl/XlBvv7llBan8Yd8HXfYtXsP6Q=;
 b=F1aYkEmTSy5GfY1sGqIWNimGDJxdWiuY2Op5GL9ePcE4k5ebZ5PUrqbCt11lVT40cv
 wS4aZsga42HP3sS86uyQ80Q55ab9nizDLULaRXB7fnMq9+kCt9cVAQGmvg0Aso8EKhYp
 HXbyeMB6BPBbnxv1V6725x9SD9sIC/l0Ql6GqihxmiWsVDLOcvpkT4xpSoUN7C7WiU8e
 f8nfKRQfZ50vAtHAGZ4/TcGnDXqnC944+wlO996RUWFoXmK8iMlRQGkL3tVAZR3Mn96H
 p1HXp78RbFEg0e0lY9JMkZYSkFfCWYPzk95dBtYORfPUt3d7Vn6KdfZWz5XfK3MdoAG3
 jG+g==
X-Gm-Message-State: ALyK8tLs/h3RVnAbWCNLX0ivGGS7MibOxdQieg3YKOJx9dnH0VD6wrZ+zdmcLkfeMoK1zyj1
X-Received: by 10.194.246.129 with SMTP id xw1mr2237917wjc.142.1465564761870; 
 Fri, 10 Jun 2016 06:19:21 -0700 (PDT)
Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184])
 by smtp.gmail.com with ESMTPSA id o4sm12302758wjx.45.2016.06.10.06.19.20
 (version=TLSv1/SSLv3 cipher=OTHER);
 Fri, 10 Jun 2016 06:19:21 -0700 (PDT)
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org
Date: Fri, 10 Jun 2016 15:19:07 +0200
Message-Id: <1465564749-1405-5-git-send-email-thomas.monjalon@6wind.com>
X-Mailer: git-send-email 2.7.0
In-Reply-To: <1465564749-1405-1-git-send-email-thomas.monjalon@6wind.com>
References: <1464367686-3475-1-git-send-email-ferruh.yigit@intel.com>
 <1465564749-1405-1-git-send-email-thomas.monjalon@6wind.com>
Subject: [dpdk-dev] [PATCH v2 4/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 13:19:22 -0000

From: Ferruh Yigit <ferruh.yigit@intel.com>

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>
---
v2: remove workarounds and workaround comment
---
 mk/exec-env/linuxapp/rte.vars.mk | 3 ---
 mk/rte.app.mk                    | 3 +++
 2 files changed, 3 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 9306b30..d01a79f 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -50,6 +50,9 @@ ifeq ($(NO_LDSCRIPT),)
 LDSCRIPT = $(RTE_LDSCRIPT)
 endif
 
+# Link only the libraries used in the application
+LDFLAGS += --as-needed
+
 # default path for libs
 _LDLIBS-y += -L$(RTE_SDK_BIN)/lib
 
-- 
2.7.0