aboutsummaryrefslogtreecommitdiff
path: root/tcwg-properties/tcwg-endianness.sh
blob: 1ab422d0a3687ad5e7ee7a52c74c8c63be39ab99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

endianness=$(file hello.exe | grep -o .SB)
expected=
case ${TARGET} in
    armeb*) expected=MSB ;;
    arm*) expected=LSB ;;
    aarch64_be*) expected=MSB ;;
    aarch64*) expected=LSB ;;
    *)
	echo "Error: unsupported target: ${TARGET}"
	exit 1
	;;
esac

if [ x${expected} = x"${endianness}" ]; then
    exit 0
else
    echo "Error: wrong endianness (expected ${expected}, got ${endianness})"
    exit 1
fi