From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by dpdk.org (Postfix) with ESMTP id 8FF147F48 for ; Wed, 17 Dec 2014 22:59:56 +0100 (CET) Received: by mail-wi0-f174.google.com with SMTP id h11so17292973wiw.7 for ; Wed, 17 Dec 2014 13:59:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=czU8hIL5qp9TfdG7liilzKE4G6aWtzo9YcrR3vZhwfM=; b=Bn6dwxrc5hwX/w/gQb2PIzjOW5JQ9QBrPhENN+zcWDaNivV5Zl4WhoGjKa6Qt47JiT rr2yFKNl00nlq0vWPZb+3XqLBd17yo8Lo9nMCDJb/Qhr/hSXgUD5Pg7pR5LTMMG23lbV WEXIVSbaBXDmfaAv2EfR+fUo81tOXuK7eGieeoeFahoOwQDP1PZwfwanY+zjy6BP3ug9 NmbhmxljOvlgI75CoEoYC10z2sw1prcbrQG2L4uP6D46LEp42qsyO5jChGx8749SCwKl LHstfvypL9LHSFMFKdB2RtNZA7kEBtIJJgxaIL6+TkSHuGH5wwYBsIu166S7rpu1xAnT vRHw== X-Gm-Message-State: ALoCoQlEnaQziyZ9WAhhEeakOxwT3m7++KaCaSGNsotFADY9JSBot4zrjxCahsugDkx2mMUXmXS4 X-Received: by 10.180.218.39 with SMTP id pd7mr18624395wic.21.1418853596426; Wed, 17 Dec 2014 13:59:56 -0800 (PST) Received: from localhost.localdomain (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id js5sm22467293wid.11.2014.12.17.13.59.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Dec 2014 13:59:55 -0800 (PST) From: Thomas Monjalon To: dev@dpdk.org Date: Wed, 17 Dec 2014 22:59:18 +0100 Message-Id: <1418853558-2445-4-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418853558-2445-1-git-send-email-thomas.monjalon@6wind.com> References: <2594499.JbYxbdnDqd@xps13> <1418853558-2445-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-dev] [PATCH 3/3] mk: fix link with CC 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: Wed, 17 Dec 2014 21:59:56 -0000 It appeared in commit 21cdc2e77a4ca999 ("fix 32-bit link with gcc") that linker options must be prefixed by -Wl, when using CC. So CPU_LDFLAGS is prefixed in rte.lib.mk. Then commit 815cfb7925bb6de ("fix link of combined shared library using CC") introduced another prefixing of CPU_LDFLAGS in rte.sharelib.mk, included in lib/Makefile. Because CPU_LDFLAGS is an exported variable, the prefixing is done twice. Initial patch of commit 815cfb7925bb6de had a workaround but it hasn't been applied in favor of this proper fix. Now variables are not overriden when prefixing. Signed-off-by: Thomas Monjalon --- mk/rte.app.mk | 5 ++--- mk/rte.lib.mk | 6 ++++-- mk/rte.shared.mk | 6 ++---- mk/rte.sharelib.mk | 8 +++++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 3c35985..e1a0dbf 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -256,11 +256,10 @@ LDLIBS += -l$(RTE_LIBNAME) endif ifeq ($(LINK_USING_CC),1) -LDLIBS := $(call linkerprefix,$(LDLIBS)) -LDFLAGS := $(call linkerprefix,$(LDFLAGS)) override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS)) O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \ - -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LDLIBS) + -Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call linkerprefix,$(LDFLAGS)) \ + $(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS)) else O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ -Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS) diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index a67c129..81bf8e1 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -62,7 +62,9 @@ exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) 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)) +_CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) +else +_CPU_LDFLAGS := $(CPU_LDFLAGS) endif O_TO_A = $(AR) crus $(LIB) $(OBJS-y) @@ -74,7 +76,7 @@ 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 = $(LD) $(_CPU_LDFLAGS) -shared $(OBJS-y) -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_DO = @set -e; \ diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk index 42feee7..fc6b0b4 100644 --- a/mk/rte.shared.mk +++ b/mk/rte.shared.mk @@ -58,11 +58,9 @@ build: _postbuild exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) ifeq ($(LINK_USING_CC),1) -LDLIBS := $(call linkerprefix,$(LDLIBS)) -LDFLAGS := $(call linkerprefix,$(LDFLAGS)) override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS)) -O_TO_SO = $(CC) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ - -shared -o $@ $(OBJS-y) $(LDLIBS) +O_TO_SO = $(CC) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ + -shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS)) else O_TO_SO = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ -shared -o $@ $(OBJS-y) $(LDLIBS) diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk index d0cc7e3..de53558 100644 --- a/mk/rte.sharelib.mk +++ b/mk/rte.sharelib.mk @@ -50,11 +50,13 @@ OBJS = $(wildcard $(RTE_OUTPUT)/build/lib/*.o) 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)) +O_TO_S = $(LD) $(call linkerprefix,$(CPU_LDFLAGS)) \ + -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE) +else +O_TO_S = $(LD) $(CPU_LDFLAGS) \ + -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE) endif -O_TO_S = $(LD) $(CPU_LDFLAGS) -shared $(OBJS) \ - -o $(RTE_OUTPUT)/lib/$(LIB_ONE) 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)" -- 2.1.3