DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4] mk: fix compile error and ABI versioning for combined shared library
Date: Thu,  3 Dec 2015 13:51:08 +0000	[thread overview]
Message-ID: <1449150668-26017-1-git-send-email-ferruh.yigit@intel.com> (raw)
In-Reply-To: <56603A44.7040803@redhat.com>

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 <function>@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 <ferruh.yigit@intel.com>
---
 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

  reply	other threads:[~2015-12-03 13:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03  1:22 [dpdk-dev] [PATCH v2] " Ferruh Yigit
2015-12-03  1:36 ` Thomas Monjalon
2015-12-03  1:59   ` Ferruh Yigit
2015-12-03  2:15     ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
2015-12-03  2:22       ` Thomas Monjalon
2015-12-03 11:24         ` Ferruh Yigit
2015-12-03  8:18 ` [dpdk-dev] [PATCH v2] " Christian Ehrhardt
2015-12-03 11:18   ` Ferruh Yigit
2015-12-03 14:01     ` Ferruh Yigit
2015-12-03 12:49 ` Panu Matilainen
2015-12-03 13:51   ` Ferruh Yigit [this message]
2015-12-06 14:37     ` [dpdk-dev] [PATCH v4] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449150668-26017-1-git-send-email-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).