aboutsummaryrefslogtreecommitdiff
path: root/tcwg-properties/tcwg-fp.sh
blob: 150d97d71c5aafafd0a1ea3818f922f23f972e69 (plain)
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
#!/bin/bash

vfp="$(readelf -a hello.exe | grep Tag_ABI_VFP_args | sed 's/^ *//')"
fparch="$(readelf -a hello.exe | grep Tag_FP_arch | sed 's/^ *Tag_FP_arch: *//')"

fpu=$(${CC} -v 2>&1 | grep -o 'with-fpu=[^ ]*' | sed 's/with-fpu=//')
echo FPU: $fpu

expectedvfp=
expected_fparch=
case ${TARGET} in
    arm-*hf|armeb-*hf)
	expectedvfp="Tag_ABI_VFP_args: VFP registers"
	expected_fparch=VFPv3-D16
	;;
    armv8*hf)
	expectedvfp="Tag_ABI_VFP_args: VFP registers"
	expected_fparch="FP for ARMv8"
	;;
    arm*) ;;
    aarch64*) ;;
    *)
	echo "Error: unsupported target: ${TARGET}"
	exit 1
	;;
esac

if [ "x${expectedvfp}" != "x${vfp}" ]; then
    echo "Error: wrong float ABI (expected ${expectedvfp}, got ${vfp})"
    exit 1
fi

if [ "x${expected_fparch}" != x"${fparch}" ]; then
    echo "Error: wrong default FPU (expected ${expected_fparch}, got ${fparch})"
    exit 1
fi