build: check symbol maps in developer mode
Hook check-symbol-maps.sh in the symbol check when in developer mode to help developers catch issues before submitting their changes. Signed-off-by: David Marchand <david.marchand@redhat.com> Reviewed-by: Ray Kinsella <mdr@ashroe.eu>
This commit is contained in:
parent
760a67e90f
commit
cf8a9e93ac
@ -5,7 +5,9 @@
|
|||||||
MAPFILE=$1
|
MAPFILE=$1
|
||||||
OBJFILE=$2
|
OBJFILE=$2
|
||||||
|
|
||||||
LIST_SYMBOL=$(dirname $(readlink -f $0))/map-list-symbol.sh
|
ROOTDIR=$(readlink -f $(dirname $(readlink -f $0))/..)
|
||||||
|
LIST_SYMBOL=$ROOTDIR/buildtools/map-list-symbol.sh
|
||||||
|
CHECK_SYMBOL_MAPS=$ROOTDIR/devtools/check-symbol-maps.sh
|
||||||
|
|
||||||
# added check for "make -C test/" usage
|
# added check for "make -C test/" usage
|
||||||
if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ]
|
if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ]
|
||||||
@ -23,6 +25,11 @@ trap 'rm -f "$DUMPFILE"' EXIT
|
|||||||
objdump -t $OBJFILE >$DUMPFILE
|
objdump -t $OBJFILE >$DUMPFILE
|
||||||
|
|
||||||
ret=0
|
ret=0
|
||||||
|
|
||||||
|
if ! $CHECK_SYMBOL_MAPS $MAPFILE; then
|
||||||
|
ret=1
|
||||||
|
fi
|
||||||
|
|
||||||
for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3`
|
for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE |cut -d ' ' -f 3`
|
||||||
do
|
do
|
||||||
if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
|
if grep -q "\.text.*[[:space:]]$SYM$" $DUMPFILE &&
|
||||||
|
@ -7,11 +7,15 @@ cd $(dirname $0)/..
|
|||||||
# speed up by ignoring Unicode details
|
# speed up by ignoring Unicode details
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
|
if [ $# = 0 ] ; then
|
||||||
|
set -- $(find lib drivers -name '*.map')
|
||||||
|
fi
|
||||||
|
|
||||||
ret=0
|
ret=0
|
||||||
|
|
||||||
find_orphan_symbols ()
|
find_orphan_symbols ()
|
||||||
{
|
{
|
||||||
for map in $(find lib drivers -name '*.map') ; do
|
for map in $@ ; do
|
||||||
for sym in $(sed -rn 's,^([^}]*_.*);.*$,\1,p' $map) ; do
|
for sym in $(sed -rn 's,^([^}]*_.*);.*$,\1,p' $map) ; do
|
||||||
if echo $sym | grep -q '^per_lcore_' ; then
|
if echo $sym | grep -q '^per_lcore_' ; then
|
||||||
symsrc=${sym#per_lcore_}
|
symsrc=${sym#per_lcore_}
|
||||||
@ -27,7 +31,7 @@ find_orphan_symbols ()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
orphan_symbols=$(find_orphan_symbols)
|
orphan_symbols=$(find_orphan_symbols $@)
|
||||||
if [ -n "$orphan_symbols" ] ; then
|
if [ -n "$orphan_symbols" ] ; then
|
||||||
echo "Found only in symbol map file:"
|
echo "Found only in symbol map file:"
|
||||||
echo "$orphan_symbols" | sed 's,^,\t,'
|
echo "$orphan_symbols" | sed 's,^,\t,'
|
||||||
@ -36,13 +40,13 @@ fi
|
|||||||
|
|
||||||
find_duplicate_symbols ()
|
find_duplicate_symbols ()
|
||||||
{
|
{
|
||||||
for map in $(find lib drivers -name '*.map') ; do
|
for map in $@ ; do
|
||||||
buildtools/map-list-symbol.sh $map | \
|
buildtools/map-list-symbol.sh $map | \
|
||||||
sort | uniq -c | grep -v " 1 $map" || true
|
sort | uniq -c | grep -v " 1 $map" || true
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
duplicate_symbols=$(find_duplicate_symbols)
|
duplicate_symbols=$(find_duplicate_symbols $@)
|
||||||
if [ -n "$duplicate_symbols" ] ; then
|
if [ -n "$duplicate_symbols" ] ; then
|
||||||
echo "Found duplicates in symbol map file:"
|
echo "Found duplicates in symbol map file:"
|
||||||
echo "$duplicate_symbols"
|
echo "$duplicate_symbols"
|
||||||
|
Loading…
Reference in New Issue
Block a user