From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 23C267E7A for ; Thu, 9 Oct 2014 14:59:06 +0200 (CEST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by fmsmga101.fm.intel.com with ESMTP; 09 Oct 2014 06:05:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,684,1406617200"; d="scan'208";a="483057454" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by azsmga001.ch.intel.com with ESMTP; 09 Oct 2014 06:05:01 -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 s99D50QM005595; Thu, 9 Oct 2014 14:05:00 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s99D50NY029147; Thu, 9 Oct 2014 14:05:00 +0100 Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id s99D50b0029143; Thu, 9 Oct 2014 14:05:00 +0100 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Thu, 9 Oct 2014 14:04:58 +0100 Message-Id: <1412859898-29068-7-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1412859898-29068-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1412592755-3370-1-git-send-email-sergio.gonzalez.monroy@intel.com> <1412859898-29068-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v3 6/6] Link apps/DSOs against EXECENV_LDLIBS with --as-needed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2014 12:59:08 -0000 Include external shared libs dependencies when building shared libraries. Signed-off-by: Sergio Gonzalez Monroy --- mk/rte.app.mk | 4 ++-- mk/rte.lib.mk | 8 +++++++- mk/rte.sharelib.mk | 7 ++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 5e00e67..e775ad7 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -62,9 +62,9 @@ ifeq ($(NO_AUTOLIBS),) LDLIBS += --whole-archive LDLIBS += -l$(RTE_LIBNAME) LDLIBS += --no-whole-archive -LDLIBS += --start-group +LDLIBS += --as-needed LDLIBS += $(EXECENV_LDLIBS) -LDLIBS += --end-group +LDLIBS += --no-as-needed endif # ifeq ($(NO_AUTOLIBS),) diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index e7420bf..947e17d 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -59,14 +59,20 @@ build: _postbuild exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) +O_TO_S_LDLIBS := --as-needed +O_TO_S_LDLIBS += $(EXECENV_LDLIBS) +O_TO_S_LDLIBS += --no-as-needed + ifeq ($(LINK_USING_CC),1) # Override the definition of LD here, since we're linking with CC LD := $(CC) LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) +O_TO_S_LDLIBS := $(call linkerprefix,$(O_TO_S_LDLIBS)) endif -O_TO_S = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -shared $(OBJS-y) -o $(LIB) +O_TO_S = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -shared $(OBJS-y) \ + $(O_TO_S_LDLIBS) -o $(LIB) O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #') # fix syntax highlight O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)") O_TO_S_CMD = "cmd_$@ = $(O_TO_S_STR)" diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk index 8fc6548..380aa7d 100644 --- a/mk/rte.sharelib.mk +++ b/mk/rte.sharelib.mk @@ -40,11 +40,16 @@ else LIB_ONE := lib$(RTE_LIBNAME).a endif +O_TO_L_LDLIBS := --as-needed +O_TO_L_LDLIBS += $(EXECENV_LDLIBS) +O_TO_L_LDLIBS += --no-as-needed + ifeq ($(LINK_USING_CC),1) # Override the definition of LD here, since we're linking with CC LD := $(CC) LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) +O_TO_L_LDLIBS := $(call linkerprefix,$(O_TO_L_LDLIBS)) endif .PHONY:sharelib @@ -54,7 +59,7 @@ OBJS = $(wildcard $(RTE_OUTPUT)/build/lib/*.o) ifeq ($(RTE_BUILD_SHARED_LIB),y) O_TO_L = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -shared $(OBJS)\ - -o $(RTE_OUTPUT)/lib/$(LIB_ONE) + $(O_TO_L_LDLIBS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE) L_DISP=LD else O_TO_L = $(AR) crus $(RTE_OUTPUT)/lib/$(LIB_ONE) $(OBJS) -- 1.9.3