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 0EB817E9D for ; Thu, 23 Oct 2014 17:28:23 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 23 Oct 2014 08:35:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,775,1406617200"; d="scan'208";a="610033345" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 23 Oct 2014 08:35:51 -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 s9NFZogY024540 for ; Thu, 23 Oct 2014 16:35:50 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s9NFZorG000731 for ; Thu, 23 Oct 2014 16:35:50 +0100 Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id s9NFZocN000727 for dev@dpdk.org; Thu, 23 Oct 2014 16:35:50 +0100 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Thu, 23 Oct 2014 16:35:50 +0100 Message-Id: <1414078550-692-1-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 Subject: [dpdk-dev] [PATCH] mk: link combined lib using 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: Thu, 23 Oct 2014 15:28:25 -0000 Building combined shared libs fails if we set EXTRA_CFLAGS=-O0. /usr/bin/ld: test: hidden symbol `mknod' in /usr/lib64/libc_nonshared.a(mknod.oS) is referenced by DSO /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status Fix: link combined shared lib using CC if LINK_USING_CC is enabled. Signed-off-by: Sergio Gonzalez Monroy --- mk/rte.lib.mk | 1 - mk/rte.sharelib.mk | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index d83e808..a6abd6d 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -63,7 +63,6 @@ ifeq ($(LINK_USING_CC),1) # Override the definition of LD here, since we're linking with CC LD := $(CC) $(CPU_CFLAGS) LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) -CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) endif O_TO_A = $(AR) crus $(LIB) $(OBJS-y) diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk index c0a811a..1fac0ad 100644 --- a/mk/rte.sharelib.mk +++ b/mk/rte.sharelib.mk @@ -29,6 +29,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +include $(RTE_SDK)/mk/internal/rte.build-pre.mk + # VPATH contains at least SRCDIR VPATH += $(SRCDIR) @@ -45,7 +47,15 @@ sharelib: $(LIB_ONE) FORCE OBJS = $(wildcard $(RTE_OUTPUT)/build/lib/*.o) -O_TO_S = $(LD) $(CPU_LDFLAGS) -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE) +ifeq ($(LINK_USING_CC),1) +# Override the definition of LD here, since we're linking with CC +LD := $(CC) $(CPU_CFLAGS) +LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs) +CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) +endif + +O_TO_S = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -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)" -- 1.9.3