From patchwork Wed Apr 8 15:07:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Gonzalez Monroy X-Patchwork-Id: 4261 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id A2CE55A52; Wed, 8 Apr 2015 17:07:31 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 8A5A1377A for ; Wed, 8 Apr 2015 17:07:29 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 08 Apr 2015 08:07:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,545,1422950400"; d="scan'208";a="552916147" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 08 Apr 2015 08:07:27 -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 t38F7QR2016609 for ; Wed, 8 Apr 2015 16:07:26 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t38F7QGH005651 for ; Wed, 8 Apr 2015 16:07:26 +0100 Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id t38F7QrV005647 for dev@dpdk.org; Wed, 8 Apr 2015 16:07:26 +0100 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Wed, 8 Apr 2015 16:07:25 +0100 Message-Id: <1428505645-5578-6-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1428505645-5578-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1428505645-5578-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v3 5/5] mk: update LDLIBS for app building 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Given the circular dependencies between eal, malloc, mempool and ring libraries and that eal does not have proper DT_NEEDED entries, we work around it by forcing linking against mentioned libraries by preceding them with --no-as-needed flag when building shared libraries. This patch also does: - Set --start-group/--end-group and --whole-archive/--no-whole-archive flags only when linking against static DPDK libs. - Set --as-needed for all libraries but eal, malloc, mempool and ring when linking against shared DPDK libs. - Link against EXECENV_LIBS always with --as-needed flag. Signed-off-by: Sergio Gonzalez Monroy --- mk/rte.app.mk | 54 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index e8630b6..2d6b2ca 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -59,7 +59,30 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib # ifeq ($(NO_AUTOLIBS),) -LDLIBS += --whole-archive +LDLIBS += --no-as-needed +ifneq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LDLIBS += --start-group +endif + +ifeq ($(CONFIG_RTE_LIBRTE_EAL),y) +LDLIBS += -lrte_eal +endif + +ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y) +LDLIBS += -lrte_malloc +endif + +ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y) +LDLIBS += -lrte_mempool +endif + +ifeq ($(CONFIG_RTE_LIBRTE_RING),y) +LDLIBS += -lrte_ring +endif + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LDLIBS += --as-needed +endif ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y) LDLIBS += -lrte_distributor @@ -127,7 +150,7 @@ LDLIBS += -lm LDLIBS += -lrt endif -ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y) +ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) LDLIBS += -lrte_vhost endif @@ -143,8 +166,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y) LDLIBS += -libverbs endif -LDLIBS += --start-group - ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y) LDLIBS += -lrte_kvargs endif @@ -161,22 +182,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y) LDLIBS += -lethdev endif -ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y) -LDLIBS += -lrte_malloc -endif - -ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y) -LDLIBS += -lrte_mempool -endif - -ifeq ($(CONFIG_RTE_LIBRTE_RING),y) -LDLIBS += -lrte_ring -endif - -ifeq ($(CONFIG_RTE_LIBRTE_EAL),y) -LDLIBS += -lrte_eal -endif - ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y) LDLIBS += -lrte_cmdline endif @@ -196,6 +201,7 @@ endif ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n) # plugins (link only if static libraries) +LDLIBS += --whole-archive ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y) LDLIBS += -lrte_pmd_vmxnet3_uio @@ -241,14 +247,14 @@ ifeq ($(CONFIG_RTE_LIBRTE_PMD_AF_PACKET),y) LDLIBS += -lrte_pmd_af_packet endif +LDLIBS += --no-whole-archive +LDLIBS += --end-group +LDLIBS += --as-needed + endif # plugins LDLIBS += $(EXECENV_LDLIBS) -LDLIBS += --end-group - -LDLIBS += --no-whole-archive - endif # ifeq ($(NO_AUTOLIBS),) LDLIBS += $(CPU_LDLIBS)