From 6248e442ee01a76d6230472329b6afe9b6628478 Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Fri, 10 Jun 2016 15:19:07 +0200 Subject: [PATCH] mk: prevent overlinking in applications 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 | 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 d51bd17034..a8a1ee4cbd 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 9306b30f98..d01a79fda8 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.20.1