From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id CA00A593A for ; Thu, 12 Mar 2015 17:28:11 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 12 Mar 2015 09:26:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,389,1422950400"; d="scan'208";a="679215176" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 12 Mar 2015 09:28:09 -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 t2CGS8xG027450; Thu, 12 Mar 2015 16:28:08 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t2CGS7gR016996; Thu, 12 Mar 2015 16:28:07 GMT Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id t2CGS7ZZ016992; Thu, 12 Mar 2015 16:28:07 GMT From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Thu, 12 Mar 2015 16:28:01 +0000 Message-Id: <1426177681-16931-5-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1426177681-16931-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1422544811-26385-1-git-send-email-sergio.gonzalez.monroy@intel.com> <1426177681-16931-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v2 4/4] 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: , X-List-Received-Date: Thu, 12 Mar 2015 16:28:12 -0000 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 --- lib/librte_jobstats/Makefile | 2 ++ lib/librte_pmd_fm10k/Makefile | 2 ++ lib/librte_pmd_mlx4/Makefile | 2 ++ lib/librte_pmd_null/Makefile | 2 ++ lib/librte_reorder/Makefile | 2 ++ mk/rte.app.mk | 57 +++++++++++++++++++++++-------------------- 6 files changed, 40 insertions(+), 27 deletions(-) diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile index 136a448..04589d4 100644 --- a/lib/librte_jobstats/Makefile +++ b/lib/librte_jobstats/Makefile @@ -41,6 +41,8 @@ EXPORT_MAP := rte_jobstats_version.map LIBABIVER := 1 +LDLIBS += -lrte_eal + # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_JOBSTATS) := rte_jobstats.c diff --git a/lib/librte_pmd_fm10k/Makefile b/lib/librte_pmd_fm10k/Makefile index 998bf23..618235a 100644 --- a/lib/librte_pmd_fm10k/Makefile +++ b/lib/librte_pmd_fm10k/Makefile @@ -79,6 +79,8 @@ $(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)) VPATH += $(RTE_SDK)/lib/librte_pmd_fm10k/base +LDLIBS += -lrte_eal -lrte_malloc -lethdev + # # all source are stored in SRCS-y # diff --git a/lib/librte_pmd_mlx4/Makefile b/lib/librte_pmd_mlx4/Makefile index 6666813..9193f05 100644 --- a/lib/librte_pmd_mlx4/Makefile +++ b/lib/librte_pmd_mlx4/Makefile @@ -58,6 +58,8 @@ CFLAGS += -Wno-error=cast-qual EXPORT_MAP := rte_pmd_mlx4_version.map LIBABIVER := 1 +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_malloc -lethdev -libverbs + # DEBUG which is usually provided on the command-line may enable # CONFIG_RTE_LIBRTE_MLX4_DEBUG. ifeq ($(DEBUG),1) diff --git a/lib/librte_pmd_null/Makefile b/lib/librte_pmd_null/Makefile index 6472015..c9bf1fd 100644 --- a/lib/librte_pmd_null/Makefile +++ b/lib/librte_pmd_null/Makefile @@ -43,6 +43,8 @@ EXPORT_MAP := rte_pmd_null_version.map LIBABIVER := 1 +LDLIBS += -lrte_eal -lrte_malloc -lethdev -lrte_kvargs + # # all source are stored in SRCS-y # diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile index 0c01de1..2c8f774 100644 --- a/lib/librte_reorder/Makefile +++ b/lib/librte_reorder/Makefile @@ -41,6 +41,8 @@ EXPORT_MAP := rte_reorder_version.map LIBABIVER := 1 +LDLIBS += -lrte_eal -lrte_malloc + # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_REORDER) := rte_reorder.c diff --git a/mk/rte.app.mk b/mk/rte.app.mk index e2baa49..7e225fd 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,15 +150,12 @@ LDLIBS += -lm LDLIBS += -lrt endif -ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y) -LDLIBS += -lrte_vhost -endif - ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y) LDLIBS += -lpcap endif ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) +LDLIBS += -lrte_vhost LDLIBS += -lfuse endif @@ -143,8 +163,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 +179,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 +198,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 +244,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) -- 1.9.3