1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#! /bin/sh
mkdir -p out || exit 99
name=$( basename "$0" )
datafile="$srcdir/elf-endian.data"
dumpfile="out/${name}.dump"
./mkelf "$dumpfile" <<EOF
ei_class = 2
ei_data = 2
e_machine = 22
e_phoff = 64
DATA = $datafile
EOF
rc=$?
if [ $rc -ne 0 ]; then
echo "Cannot create ELF file" >&2
exit $rc
fi
echo "Created ELF dump: $dumpfile"
totalrc=0
resultfile="out/${name}16.result"
expectfile="$srcdir/${name}16.expect"
./dumpdata -s 2 "$dumpfile" 0 8 >"$resultfile"
rc=$?
if [ $rc -ne 0 ]; then
echo "Cannot dump ELF data" >&2
exit $rc
fi
if ! diff "$expectfile" "$resultfile"; then
echo "Results do not match" >&2
totalrc=1
fi
resultfile="out/${name}32.result"
expectfile="$srcdir/${name}32.expect"
./dumpdata -s 4 "$dumpfile" 0 4 >"$resultfile"
rc=$?
if [ $rc -ne 0 ]; then
echo "Cannot dump ELF data" >&2
exit $rc
fi
if ! diff "$expectfile" "$resultfile"; then
echo "Results do not match" >&2
totalrc=1
fi
resultfile="out/${name}64.result"
expectfile="$srcdir/${name}64.expect"
./dumpdata -s 8 "$dumpfile" 0 2 >"$resultfile"
rc=$?
if [ $rc -ne 0 ]; then
echo "Cannot dump ELF data" >&2
exit $rc
fi
if ! diff "$expectfile" "$resultfile"; then
echo "Results do not match" >&2
totalrc=1
fi
exit $totalrc
|