numam-dpdk/buildtools/check-symbols.sh
Ferruh Yigit 05a38d7c75 compat: provide experimental alias for matured ABI
On v20.02 some APIs matured and symbols moved from EXPERIMENTAL to
DPDK_20.0.1 block.

This had the affect of breaking the applications that were using these
APIs on v19.11. Although there is no modification of the APIs and the
action is positive and matures the APIs, the affect can be negative to
applications.

When a maintainer is promoting an API to become part of the next major
ABI version by removing the experimental tag. The maintainer may
choose to offer an alias to the experimental tag, to prevent these
breakages in future.

The following changes are made to enabling aliasing:

Updated to the ABI policy and ABI versioning documents.

Created VERSION_SYMBOL_EXPERIMENTAL helper macro.

Updated the 'check-symbols.sh' tool, which was complaining that the
symbol is in EXPERIMENTAL tag in .map file but it is not in the
.experimental section (__rte_experimental tag is missing).
Updated tool in a way it won't complain if the symbol in the
EXPERIMENTAL tag duplicated in some other block in .map file (versioned)

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
2020-05-18 19:46:25 +02:00

90 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause
MAPFILE=$1
OBJFILE=$2
LIST_SYMBOL=$(dirname $(readlink -f $0))/map-list-symbol.sh
# added check for "make -C test/" usage
if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ]
then
exit 0
fi
if [ -d $MAPFILE ]
then
exit 0
fi
DUMPFILE=$(mktemp -t dpdk.${0##*/}.XXX.objdump)
trap 'rm -f "$DUMPFILE"' EXIT
objdump -t $OBJFILE >$DUMPFILE
ret=0
for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3`
do
if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
! grep -q "\.text\.experimental.*[[:space:]]$SYM$" $DUMPFILE &&
$LIST_SYMBOL -s $SYM $MAPFILE | grep -q EXPERIMENTAL
then
cat >&2 <<- END_OF_MESSAGE
$SYM is not flagged as experimental
but is listed in version map
Please add __rte_experimental to the definition of $SYM
END_OF_MESSAGE
ret=1
fi
done
# Filter out symbols suffixed with a . for icc
for SYM in `awk '{
if ($2 != "l" && $4 == ".text.experimental" && !($NF ~ /\.$/)) {
print $NF
}
}' $DUMPFILE`
do
$LIST_SYMBOL -S EXPERIMENTAL -s $SYM -q $MAPFILE || {
cat >&2 <<- END_OF_MESSAGE
$SYM is flagged as experimental
but is not listed in version map
Please add $SYM to the version map
END_OF_MESSAGE
ret=1
}
done
for SYM in `$LIST_SYMBOL -S INTERNAL $MAPFILE |cut -d ' ' -f 3`
do
if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
! grep -q "\.text\.internal.*[[:space:]]$SYM$" $DUMPFILE
then
cat >&2 <<- END_OF_MESSAGE
$SYM is not flagged as internal
but is listed in version map
Please add __rte_internal to the definition of $SYM
END_OF_MESSAGE
ret=1
fi
done
# Filter out symbols suffixed with a . for icc
for SYM in `awk '{
if ($2 != "l" && $4 == ".text.internal" && !($NF ~ /\.$/)) {
print $NF
}
}' $DUMPFILE`
do
$LIST_SYMBOL -S INTERNAL -s $SYM -q $MAPFILE || {
cat >&2 <<- END_OF_MESSAGE
$SYM is flagged as internal
but is not listed in version map
Please add $SYM to the version map
END_OF_MESSAGE
ret=1
}
done
exit $ret