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 1972F568A for ; Thu, 3 Dec 2015 14:51:17 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 03 Dec 2015 05:51:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,378,1444719600"; d="scan'208";a="863873125" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 03 Dec 2015 05:51:15 -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 tB3DpEqb019774; Thu, 3 Dec 2015 13:51:14 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id tB3DpEWi026051; Thu, 3 Dec 2015 13:51:14 GMT Received: (from fyigit@localhost) by sivswdev02.ir.intel.com with id tB3DpDB9026047; Thu, 3 Dec 2015 13:51:13 GMT From: Ferruh Yigit To: dev@dpdk.org Date: Thu, 3 Dec 2015 13:51:08 +0000 Message-Id: <1449150668-26017-1-git-send-email-ferruh.yigit@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <56603A44.7040803@redhat.com> References: <56603A44.7040803@redhat.com> Subject: [dpdk-dev] [PATCH v4] mk: fix compile error and ABI versioning for combined shared library 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, 03 Dec 2015 13:51:18 -0000 Fixes following error (observed when versioning macros used): LD libdpdk.so /usr/bin/ld: /root/dpdk/build/lib/libdpdk.so: version node not found for symbol @DPDK_x.y Also resulting combined library contains symbol version information: $ readelf -a build/lib/libdpdk.so | grep rte_eal_ | grep @ | head <...> GLOBAL DEFAULT 12 rte_eal_alarm_set@@DPDK_2.0 <...> GLOBAL DEFAULT 12 rte_eal_pci_write_config@@DPDK_2.1 <...> GLOBAL DEFAULT 12 rte_eal_remote_launch@@DPDK_2.0 ... Versioning fixed by merging all version scripts into one automatically and feeding it to final library. Signed-off-by: Ferruh Yigit --- mk/rte.sharelib.mk | 6 +++++- scripts/merge_maps.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 scripts/merge_maps.sh diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk index 7bb7219..6029b71 100644 --- a/mk/rte.sharelib.mk +++ b/mk/rte.sharelib.mk @@ -40,6 +40,8 @@ LIB_ONE := lib$(RTE_LIBNAME).so else LIB_ONE := lib$(RTE_LIBNAME).a endif +COMBINED_MAP=$(BUILDDIR)/lib/libdpdk.map +COMBINED_LDFLAGS += --version-script=$(COMBINED_MAP) endif .PHONY:sharelib @@ -51,9 +53,10 @@ ifeq ($(LINK_USING_CC),1) # Override the definition of LD here, since we're linking with CC LD := $(CC) $(CPU_CFLAGS) O_TO_S = $(LD) $(call linkerprefix,$(CPU_LDFLAGS)) \ + $(call linkerprefix,$(COMBINED_LDFLAGS)) \ -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE) else -O_TO_S = $(LD) $(CPU_LDFLAGS) \ +O_TO_S = $(LD) $(CPU_LDFLAGS) $(COMBINED_LDFLAGS) \ -shared $(OBJS) -o $(RTE_OUTPUT)/lib/$(LIB_ONE) endif @@ -79,6 +82,7 @@ ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y) ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) $(LIB_ONE): FORCE @[ -d $(dir $@) ] || mkdir -p $(dir $@) + @$(SRCDIR)/scripts/merge_maps.sh > $(COMBINED_MAP) $(O_TO_S_DO) else $(LIB_ONE): FORCE diff --git a/scripts/merge_maps.sh b/scripts/merge_maps.sh new file mode 100755 index 0000000..edc88de --- /dev/null +++ b/scripts/merge_maps.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +FILES=$(find "$RTE_SDK"/lib "$RTE_SDK"/drivers -name "*_version.map") +SYMBOLS=$(grep -h "{" $FILES | sort -u | sed 's/{//') + +first=0 +prev_sym="none" + +for s in $SYMBOLS; do + echo "$s {" + echo " global:" + echo "" + for f in $FILES; do + sed -n "/$s {/,/}/p" "$f" | sed '/^$/d' | grep -v global | grep -v local | sed -e '1d' -e '$d' + done | sort -u + echo "" + if [ $first -eq 0 ]; then + first=1; + echo " local: *;"; + fi + if [ "$prev_sym" = "none" ]; then + echo "};"; + prev_sym=$s; + else + echo "} $prev_sym;"; + prev_sym=$s; + fi + echo "" +done -- 2.5.0