From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 75FC05A85 for ; Thu, 29 Jan 2015 16:20:22 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 29 Jan 2015 07:14:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,486,1418112000"; d="scan'208";a="678025261" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 29 Jan 2015 07:20:14 -0800 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 t0TFKCfD031973 for ; Thu, 29 Jan 2015 15:20:12 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t0TFKCE6026465 for ; Thu, 29 Jan 2015 15:20:12 GMT Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id t0TFKCwh026461 for dev@dpdk.org; Thu, 29 Jan 2015 15:20:12 GMT From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Thu, 29 Jan 2015 15:20:09 +0000 Message-Id: <1422544811-26385-7-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1422544811-26385-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1422544811-26385-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH 6/8] mk: use LDLIBS when linking shared libraries 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, 29 Jan 2015 15:27:10 -0000 This patch mainly makes use of the LDLIBS variable when linking shared libraries, setting proper DT_NEEDED entries. This patch also fix a few nits like syntax highlighting, the command string (O_TO_S_STR) used for linking shared libraries and the displayed of dependencies when debugging is enable (D). Signed-off-by: Sergio Gonzalez Monroy --- mk/rte.lib.mk | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index 7c99fd1..559c76a 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -59,16 +59,19 @@ build: _postbuild exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) +_LDLIBS := -z defs --as-needed $(LDLIBS) $(EXECENV_LDLIBS) --no-as-needed + ifeq ($(LINK_USING_CC),1) # Override the definition of LD here, since we're linking with CC LD := $(CC) $(CPU_CFLAGS) _CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) +_LDLIBS := $(call linkerprefix,$(_LDLIBS)) else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif O_TO_A = $(AR) crus $(LIB) $(OBJS-y) -O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight +O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #')# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)") O_TO_A_CMD = "cmd_$@ = $(O_TO_A_STR)" O_TO_A_DO = @set -e; \ @@ -76,9 +79,11 @@ O_TO_A_DO = @set -e; \ $(O_TO_A) && \ echo $(O_TO_A_CMD) > $(call exe2cmd,$(@)) -O_TO_S = $(LD) $(_CPU_LDFLAGS) -shared $(OBJS-y) -o $(LIB) -O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight +O_TO_S = $(LD) $(_CPU_LDFLAGS) -L $(RTE_OUTPUT)/lib \ + -shared $(OBJS-y) $(_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)" O_TO_S_DO = @set -e; \ echo $(O_TO_S_DISP); \ $(O_TO_S) && \ @@ -93,7 +98,7 @@ ifeq ($(RTE_BUILD_SHARED_LIB),y) $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE @[ -d $(dir $@) ] || mkdir -p $(dir $@) $(if $(D),\ - @echo -n "$< -> $@ " ; \ + @echo -n "$? -> $@ " ; \ echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_S_STR))) " ; \ echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ @@ -108,7 +113,7 @@ else $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE @[ -d $(dir $@) ] || mkdir -p $(dir $@) $(if $(D),\ - @echo -n "$< -> $@ " ; \ + @echo -n "$? -> $@ " ; \ echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_A_STR))) " ; \ echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ -- 1.9.3