elfcmp.sh revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
#
# elfcmp - compare significant sections in two ELF files
#
# usage: elfcmp [-v] [-S] [-s section ...] <f1> <f2>
#
VERBOSE=0
SECTIONLIST=""
ERRORS=0
echo 'Usage: elfcmp [-v] [-S] [-s section ...] <f1> <f2>' 1>&2
exit 1
}
while [[ $# > 0 ]]
do
case "$1" in
-v)
VERBOSE=1
;;
-s)
SECTIONLIST="$2"
shift
;;
-S)
;;
-*)
;;
*)
break
;;
esac
shift
done
if [[ $# != 2 ]]
then
fi
}
}
}
# get section lists for both files into temp files
if [[ "$SECTIONLIST" = "" ]]
then
if [[ $SIGNING_CHECK = 1 ]]
then
else
fi
else
echo "$SECTIONLIST" >$TMP1
echo "$SECTIONLIST" >$TMP2
fi
# determine and print which ones aren't in both of the input files
if [[ ! -z "$NOT_IN_1" ]]
then
echo "Section(s) $NOT_IN_1 not in $1"
fi
if [[ ! -z "$NOT_IN_2" ]]
then
echo "Section(s) $NOT_IN_2 not in $2"
fi
# for all the sections which *are* common, do the following
do
then
if [[ $VERBOSE = 1 ]]
then
echo "Section $s is the same"
fi
else
echo "Section $s differs"
if [[ $VERBOSE = 1 ]]
then
fi
fi
done
# verify that allocated objects have not moved
# only applies to signed objects with a program header
if [[ $SIGNING_CHECK = 1 ]]
then
then
then
if [[ $VERBOSE = 1 ]]
then
echo "Allocated sections are the same"
fi
else
echo "Allocated section(s) changed"
if [[ $VERBOSE = 1 ]]
then
fi
fi
fi
fi
exit $ERRORS