numam-dpdk/buildtools/check-symbols.sh
Thomas Monjalon e1ab26df48 buildtools: fix build with busybox
If using busybox for mktemp and awk (as in Alpine),
some bugs prevent the script from running:

1/ It seems busybox mktemp requires the pattern to have at least
6 X and no other suffix.
The same has been fixed for other scripts in the past:
commit 3771edc354 ("buildtools: fix build for some mktemp")

2/ It seems busybox awk does not accept the regex ^.*{
except if the opening curly brace is escaped.

Fixes: 4c82473412 ("build: add internal tag check")
Fixes: 68b1f1cda5 ("build: check AVX512 rather than binutils version")
Fixes: 3290ac14eb ("buildtools: detect discrepancies for experimental symbols")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: David Marchand <david.marchand@redhat.com>
2021-03-23 08:39:11 +01: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##*/}.objdump.XXXXXX)
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