numam-dpdk/scripts/merge-maps.sh
Ferruh Yigit 9f8eeb60ef mk: fix combined lib build with ABI versioning
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>
2015-12-06 15:41:04 +01:00

30 lines
559 B
Bash
Executable File

#!/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